Patch "batman-adv: Don't skb_split skbuffs with frag_list" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    batman-adv: Don't skb_split skbuffs with frag_list

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     batman-adv-don-t-skb_split-skbuffs-with-frag_list.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7d58c7f0cc0818ffddec567dcb9c85ff4ed30c2f
Author: Sven Eckelmann <sven@xxxxxxxxxxxxx>
Date:   Sat Apr 16 13:51:10 2022 +0200

    batman-adv: Don't skb_split skbuffs with frag_list
    
    [ Upstream commit a063f2fba3fa633a599253b62561051ac185fa99 ]
    
    The receiving interface might have used GRO to receive more fragments than
    MAX_SKB_FRAGS fragments. In this case, these will not be stored in
    skb_shinfo(skb)->frags but merged into the frag list.
    
    batman-adv relies on the function skb_split to split packets up into
    multiple smaller packets which are not larger than the MTU on the outgoing
    interface. But this function cannot handle frag_list entries and is only
    operating on skb_shinfo(skb)->frags. If it is still trying to split such an
    skb and xmit'ing it on an interface without support for NETIF_F_FRAGLIST,
    then validate_xmit_skb() will try to linearize it. But this fails due to
    inconsistent information. And __pskb_pull_tail will trigger a BUG_ON after
    skb_copy_bits() returns an error.
    
    In case of entries in frag_list, just linearize the skb before operating on
    it with skb_split().
    
    Reported-by: Felix Kaechele <felix@xxxxxxxxxxx>
    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Signed-off-by: Sven Eckelmann <sven@xxxxxxxxxxxxx>
    Tested-by: Felix Kaechele <felix@xxxxxxxxxxx>
    Signed-off-by: Simon Wunderlich <sw@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index cc062b69fc8d..a62eedf889eb 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -490,6 +490,17 @@ int batadv_frag_send_packet(struct sk_buff *skb,
 		goto free_skb;
 	}
 
+	/* GRO might have added fragments to the fragment list instead of
+	 * frags[]. But this is not handled by skb_split and must be
+	 * linearized to avoid incorrect length information after all
+	 * batman-adv fragments were created and submitted to the
+	 * hard-interface
+	 */
+	if (skb_has_frag_list(skb) && __skb_linearize(skb)) {
+		ret = -ENOMEM;
+		goto free_skb;
+	}
+
 	/* Create one header to be copied to all fragments */
 	frag_header.packet_type = BATADV_UNICAST_FRAG;
 	frag_header.version = BATADV_COMPAT_VERSION;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux