From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385345; b=jFATVB94GSDibbh1ylPyjL6wZlt50089K9POvhpGGYgD0c6vD99ZuFe0+Dw5IuIejP5Y 274J180qUoG3UycvhVDANAEMRSFnNq/Vkw6kS/dLWwHLNdAJxwS9ke7YyLAD8clnWfAKg OFFRseOSbjdzAwrrU59PFQYrJAnr+FF/KkGY5Mat700/dUE0toHpDvikT5nmjO6h6A3Kl lDWQqvb5OaQ5HIH8TbTH0LK9McQ1iHLZxPFH1INTbj0u6b0snLvJGMgHhGoomUZzFsrDu cToZv9B6C4CAZh+l63dDskRyE5Uxa9Qi6pVBk1KHyAXHqN6wfIIMyzRyQBo990BAuRA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385345; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=ma0I3k5ZGmazBEfafmGhVslSK/BsYHY2bxszew6/vPs=; b=Ma6O1IfSPFX7ocnPMghRBF3zahOgQKUoxeB+djUlCLeem1jr2lRt/7IWMJEQck2ViSA4 KYPqH9n1jkz90e+MKyKKNEB2uS70m5Ys2s4e2WgdQ29ASuBrJlwx9BhqNk3o2Tpw/l00l bOxXFG5snmPl2B5rHQxWI1gq18EWWwTO4rBz1qe8T8aB5yqqyZUmC9UTUB4bxZKs0HPpO LP/DT4oxe+HqpqSj4WXsF1SNQ7j/W3gjrjXzyzjD7fidY784Nq7kVCktGZvVVs4t/9Xs6 TPV7oFULRcLC93QlsZmRKcEHQZAYCdCDWTRl44XvgMqck9veC0Q5dgQrGK9qjGeVYRw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=simIit5m; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68059606A322; Fri, 4 Dec 2026 11:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=simIit5m Received: by smtp.kernel.org (Postfix) with ESMTPSA id D30D21F000C2; Fri, 4 Dec 2026 11:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385345; bh=ma0I3k5ZGmazBEfafmGhVslSK/BsYHY2bxszew6/vPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=simIit5maA5r5N5RgAD2Nf4cWq6216204fDJz/uAkPIqO6IOb2r6ZTrrbCDjf7pNY vQAQCehdFB48h382Kng9u4gtYfurkCiOyBq6XN9zArRT5b9jy75KEB7297Rw7TzIIV UBzVGnnS4nOum1wN+K0Cet04w9sqZNCmVS1p247g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Zeng , Jakub Kicinski Subject: [PATCH 6.6 0518/1167] ipv4: keep XFRM headers out of corked skb lengths Date: Fri, 4 Dec 2026 18:59:05 +0900 Message-ID: <20261204100715.555001554@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kyle Zeng commit 0f47fce51a98d3d9f439c16861d519a7b833a176 upstream. __ip_append_data() allocates space for dst.header_len in the first skb, but includes that space in skb->len until __ip_make_skb() pulls it. Fragment accounting uses an MTU that already excludes the XFRM headers. As a result, the next skb can have a fraggap larger than its capped datalen, and skb_copy_and_csum_bits() can overwrite its shared info. For example, five AH tunnel states can reserve 500 bytes while leaving an effective MTU of 348. With 40 bytes of IPv4 options, the second skb has room for 288 bytes of fragment data but receives a 500-byte gap copy. The overwritten shared info is subsequently consumed by the skb release paths. Reserve the XFRM headers together with the link-layer headroom instead. This keeps skb->len, the gap-copy offsets and the trim lengths relative to the IPv4 packet throughout corking. The network and transport header addresses and the headroom available to XFRM at output are unchanged. Both paged and linear allocations, including subsequent corked appends, use the corrected accounting. Fixes: 353e5c9abd90 ("ipv4: Fix IPsec slowpath fragmentation problem") Cc: stable@vger.kernel.org Signed-off-by: Kyle Zeng Link: https://patch.msgid.link/20261030042229.74068-1-kylebot@openai.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/ip_output.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1151,16 +1151,16 @@ alloc_new_skb: */ skb->ip_summed = csummode; skb->csum = 0; - skb_reserve(skb, hh_len); + skb_reserve(skb, hh_len + exthdrlen); /* * Find where to start putting bytes. */ - data = skb_put(skb, fraglen + exthdrlen - pagedlen); - skb_set_network_header(skb, exthdrlen); + data = skb_put(skb, fraglen - pagedlen); + skb_reset_network_header(skb); skb->transport_header = (skb->network_header + fragheaderlen); - data += fragheaderlen + exthdrlen; + data += fragheaderlen; if (fraggap) { skb->csum = skb_copy_and_csum_bits(