Patch "net: ipv6: fix wrong start position when receive hop-by-hop fragment" has been added to the 6.8-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: ipv6: fix wrong start position when receive hop-by-hop fragment

to the 6.8-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-ipv6-fix-wrong-start-position-when-receive-hop-b.patch
and it can be found in the queue-6.8 subdirectory.

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



commit 4ab3437ee7e628cb236b2fc09940598ec3258226
Author: gaoxingwang <gaoxingwang1@xxxxxxxxxx>
Date:   Mon Apr 22 17:19:17 2024 +0800

    net: ipv6: fix wrong start position when receive hop-by-hop fragment
    
    [ Upstream commit 1cd354fe1e4864eeaff62f66ee513080ec946f20 ]
    
    In IPv6, ipv6_rcv_core will parse the hop-by-hop type extension header and increase skb->transport_header by one extension header length.
    But if there are more other extension headers like fragment header at this time, the skb->transport_header points to the second extension header,
    not the transport layer header or the first extension header.
    
    This will result in the start and nexthdrp variable not pointing to the same position in ipv6frag_thdr_trunced,
    and ipv6_skip_exthdr returning incorrect offset and frag_off.Sometimes,the length of the last sharded packet is smaller than the calculated incorrect offset, resulting in packet loss.
    We can use network header to offset and calculate the correct position to solve this problem.
    
    Fixes: 9d9e937b1c8b (ipv6/netfilter: Discard first fragment not including all headers)
    Signed-off-by: Gao Xingwang <gaoxingwang1@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 5ebc47da1000c..2af98edef87ee 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -369,7 +369,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
 	 * the source of the fragment, with the Pointer field set to zero.
 	 */
 	nexthdr = hdr->nexthdr;
-	if (ipv6frag_thdr_truncated(skb, skb_transport_offset(skb), &nexthdr)) {
+	if (ipv6frag_thdr_truncated(skb, skb_network_offset(skb) + sizeof(struct ipv6hdr), &nexthdr)) {
 		__IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev),
 				IPSTATS_MIB_INHDRERRORS);
 		icmpv6_param_prob(skb, ICMPV6_HDR_INCOMP, 0);




[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