From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24092262BE; Mon, 27 May 2024 19:29:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716838196; cv=none; b=ReXfHojNVHY24pSNyJGTttlmLxpZiuY+1AzTFra9ubOUDLZU4P0t6Vxyf85FEBGd+a8vucow5Xe/EWqFBVuoSzJNg/aEDFzBI0mZphVwFxkXVCP4DCp+f1lwTenadW6UbTSER4DMxqk7kEPdhtHtUmLD/wo8xgjCv0Oy1fcFpq0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716838196; c=relaxed/simple; bh=NR3JQESadvJpyaI1XrqYgTz7jDUsa90S7dZCAn2j0QY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AIjEMpUhTvgcWWs+pithFJ6bC0oCRP7kU4Han3Rf5LENqVef7DTkzRUKtAauBn5Lvf5C+3RU3obXj8V1iXtAuwV8/jAsgHLGpLj0Yl+O8Q4fJ8jTgfHXjRPOjg7lkYVPh3zt0GAveQzv0JqbYpduyURhvSmUaK+h60owyyZMHC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=t6FPoD+O; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="t6FPoD+O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE2F0C2BBFC; Mon, 27 May 2024 19:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716838196; bh=NR3JQESadvJpyaI1XrqYgTz7jDUsa90S7dZCAn2j0QY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t6FPoD+OwRDe9DMlOoFxB/GqYzeBTmYT+gUSPjUHwOOxfUvjhFUC6u3hHf5MhVdek FRRDXgqDTAEwamBnDvnHQzPi1hQmDybwHgui5fAMyZKOnBccSp8EegLnvR2DDsDSis uC3etexVtEGCozJRPSfsaYc1H5Ut5Yaffl1vB2Eg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gao Xingwang , "David S. Miller" , Sasha Levin Subject: [PATCH 6.8 301/493] net: ipv6: fix wrong start position when receive hop-by-hop fragment Date: Mon, 27 May 2024 20:55:03 +0200 Message-ID: <20240527185640.151280199@linuxfoundation.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240527185626.546110716@linuxfoundation.org> References: <20240527185626.546110716@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.8-stable review patch. If anyone has any objections, please let me know. ------------------ From: gaoxingwang [ 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/reassembly.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.43.0