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=1796388239; b=nDTUucFQUJH3V02PleID6V38Sbc5N60C/RKuKtdGbpc9SPNePwdhMPVIKnxkpR6qHYUt kYwD5rU1LwetSc+Gk0RWbOdc7QajqPOv2aj7m7qyrBOJuPu3/EG3Vjn+dyQfU5uLdmy/+ c6WLA2FApvkrd0ysVQqiJUo9MDKVsMJgsFezg5AZg/NDs6CrnrGYWe1dyA7gj6l+ODnS9 kCtjMvfg+o/TCCmOOJRX5EdP4NMgGpnVCxuvl4kxnp+WJF2yQPTiRbOHOAbsq4RCpj/zv NKaAn12zmh9meusAOeLstygZXEkISEBdlMO6mqzjKqiYwObzmKzEuhX5DXzMZB1muHg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388239; 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=IxsjIl+SfSGuyD6CRTegu9UT8OGW8LY3JF6RkTRrS1U=; b=UQyqNFGK7k+gc3xMaP6jAgTkbFRcs+X27kPGO+kzRmpl26/plcHDA4I4TMEF5Adukucq BbYEMg8DyqDjvy6YRP2oREsyHRqId39yKKFA0GUQD22BzU+zoK+JbOHJLvowOZNjJJBnN H890C1w314rM2GO/A5ebMYP1jZHWvz1iZ07cezqwPhyNbE/vwT4Fn+p8+TlGEZjEiK1Mv Lhm5CtJoCWfwsv9zePE6YFHt8TIJ0v2Q6gcB2zZOhGslYVxU/Vd1XiKYQNEWYTKKV3uEE 36cLAu1UDZ+jObGLOMuPxH9egr1mL12yzs93TLTACUBiMWKHMhLYsbeCgw/VX4ug7tA== 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="cUMnYR/N"; 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 B3C31606A322; Fri, 4 Dec 2026 12:43:59 +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=cUMnYR/N Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AE7A1F000C2; Fri, 4 Dec 2026 12:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388239; bh=IxsjIl+SfSGuyD6CRTegu9UT8OGW8LY3JF6RkTRrS1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cUMnYR/NHfGEvifdR3TPqcX7LLkoMH91I49hT0RJxpcu4c08Dt3kgAjRLJ3LMcmJG 38ZcWZ/fHmojXudTClh1beZs07tIsIN5bZwXEtxU1y2dCaUoHhkkgc1YbSmz+d73hB LukCbpDayGZ0KyoHpfwdwtQHIZyaq+7ZfYubGbS0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Zeng , Jakub Kicinski Subject: [PATCH 6.1 0497/1059] ipv4: keep XFRM headers out of corked skb lengths Date: Fri, 4 Dec 2026 19:00:28 +0900 Message-ID: <20261204100657.115701164@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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(