Patch "net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension" has been added to the 5.15-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

    net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension

to the 5.15-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:
     net-skip-offload-for-netif_f_ipv6_csum-if-ipv6-heade.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 98b4fae1d316c19b87e3cb5278458532eb4999ba
Author: Benoît Monin <benoit.monin@xxxxxx>
Date:   Thu Oct 24 16:01:54 2024 +0200

    net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension
    
    [ Upstream commit 04c20a9356f283da623903e81e7c6d5df7e4dc3c ]
    
    As documented in skbuff.h, devices with NETIF_F_IPV6_CSUM capability
    can only checksum TCP and UDP over IPv6 if the IP header does not
    contains extension.
    
    This is enforced for UDP packets emitted from user-space to an IPv6
    address as they go through ip6_make_skb(), which calls
    __ip6_append_data() where a check is done on the header size before
    setting CHECKSUM_PARTIAL.
    
    But the introduction of UDP encapsulation with fou6 added a code-path
    where it is possible to get an skb with a partial UDP checksum and an
    IPv6 header with extension:
    * fou6 adds a UDP header with a partial checksum if the inner packet
    does not contains a valid checksum.
    * ip6_tunnel adds an IPv6 header with a destination option extension
    header if encap_limit is non-zero (the default value is 4).
    
    The thread linked below describes in more details how to reproduce the
    problem with GRE-in-UDP tunnel.
    
    Add a check on the network header size in skb_csum_hwoffload_help() to
    make sure no IPv6 packet with extension header is handed to a network
    device with NETIF_F_IPV6_CSUM capability.
    
    Link: https://lore.kernel.org/netdev/26548921.1r3eYUQgxm@benoit.monin/T/#u
    Fixes: aa3463d65e7b ("fou: Add encap ops for IPv6 tunnels")
    Signed-off-by: Benoît Monin <benoit.monin@xxxxxx>
    Reviewed-by: Willem de Bruijn <willemb@xxxxxxxxxx>
    Link: https://patch.msgid.link/5fbeecfc311ea182aa1d1c771725ab8b4cac515e.1729778144.git.benoit.monin@xxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/dev.c b/net/core/dev.c
index 8a22ce15b7f53..15ed4a79be46f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3668,6 +3668,9 @@ int skb_csum_hwoffload_help(struct sk_buff *skb,
 		return 0;
 
 	if (features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) {
+		if (vlan_get_protocol(skb) == htons(ETH_P_IPV6) &&
+		    skb_network_header_len(skb) != sizeof(struct ipv6hdr))
+			goto sw_checksum;
 		switch (skb->csum_offset) {
 		case offsetof(struct tcphdr, check):
 		case offsetof(struct udphdr, check):
@@ -3675,6 +3678,7 @@ int skb_csum_hwoffload_help(struct sk_buff *skb,
 		}
 	}
 
+sw_checksum:
 	return skb_checksum_help(skb);
 }
 EXPORT_SYMBOL(skb_csum_hwoffload_help);




[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