Article View: linux.kernel.netdev
Article #25246[PATCH 16/22] xfrm: iptfs: make room before copying a continuation in reassembly
From: Steffen Klassert
Date: Tue, 01 Dec 2026 12:41
Date: Tue, 01 Dec 2026 12:41
60 lines
11615 bytes
11615 bytes
From: Andrii Tereshchenko <opensource@andrii.net>
When iptfs_reassem_cont() cannot share a continuation as page frags, it
linearizes the in-progress skb and copies the data in with skb_put(),
without checking the tailroom. An skb started by iptfs_pskb_add_frags()
has little room after linearizing, so a larger continuation panics the
kernel in softirq:
skbuff: skb_over_panic: ... len:2884 put:1442 ... end:0x6c0 dev:eth1
kernel BUG at net/core/skbuff.c:215!
Call Trace:
<IRQ>
skb_put.cold+0x1f/0x1f
iptfs_reassem_cont+0x242/0x760
iptfs_input_ordered+0x382/0x3e0
iptfs_input+0x24d/0x630
xfrm_input+0x12a5/0x29f0
After linearizing, grow the head if the rest of the inner packet does
not fit, and abandon the reassembly if that fails.
Made with an AI coding assistant, reviewed by the submitter.
Fixes: 5f2b6a909574 ("xfrm: iptfs: add skb-fragment sharing code")
Fixes: 0b352f83cabf ("xfrm: iptfs: fix skb_put() panic on non-linear skb during reassembly")
Reported-by: Piyus Kedia <piyus@iiitd.ac.in>
Closes: https://lore.kernel.org/all/20261119142308.3272570-1-piyus@iiitd.ac.in/
Link: https://lore.kernel.org/all/20260908224855.1591147-1-kuba@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Andrii Tereshchenko <opensource@andrii.net>
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/xfrm/xfrm_iptfs.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_iptfs.c b/net/xfrm/xfrm_iptfs.c
index 3fff835497b9..76272b0a1829 100644
--- a/net/xfrm/xfrm_iptfs.c
+++ b/net/xfrm/xfrm_iptfs.c
@@ -909,7 +909,15 @@ static u32 iptfs_reassem_cont(struct xfrm_iptfs_data *xtfs, u64 seq,
iptfs_skb_can_add_frags(newskb, fragwalk, data, copylen)) {
iptfs_skb_add_frags(newskb, fragwalk, data, copylen);
} else {
- if (skb_linearize(newskb)) {
+ /* A newskb started by iptfs_pskb_add_frags() has little
+ * tailroom after linearizing. Make room for the rest of
+ * the inner packet before copying.
+ */
+ if (skb_linearize(newskb) ||
+ (skb_tailroom(newskb) < ipremain &&
+ pskb_expand_head(newskb, 0,
+ ipremain - skb_tailroom(newskb),
+ GFP_ATOMIC | __GFP_NOWARN))) {
XFRM_INC_STATS(xs_net(xtfs->x),
LINUX_MIB_XFRMINBUFFERERROR);
goto abandon;
--
2.53.0
Technical Details
Message-ID:
<20261201124252.1163254-17-steffen.klassert@secunet.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375037-linux-kernel-netdev=dewy.ruReferences:
<20261201124252.1163254-1-steffen.klassert@secunet.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375037-linux-kernel-netdev=dewy.ru From: steffen.klassert@secunet.com (Steffen Klassert) Newsgroups: linux.kernel.netdev Subject: [PATCH 16/22] xfrm: iptfs: make room before copying a continuation in reassembly Date: Tue, 1 Dec 2026 13:41:42 +0100 Organization: Usenet Network Message-ID: <20261201124252.1163254-17-steffen.klassert@secunet.com> References: <20261201124252.1163254-1-steffen.klassert@secunet.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1711572"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:z8GgMqhLSfKuKN3VwI2lpKZxAMs= sha256:nlY6YZoEoJY5sX45SX/oWkb7PBFhBndti/nwZzFzLX0= sha1:Q524cGSmOOrb7jMSHh+iJul3r24= sha256:SXMDGoRr/ohrZbejpfCwq+HHlCfCgrIxyhIy9CG7dBU= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id CD47011738B; Tue, 1 Dec 2026 15:44:26 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=secunet.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JEMtbDbEwdd9; Tue, 1 Dec 2026 15:44:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-375037-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=secunet.com X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id B7309117384; Tue, 1 Dec 2026 15:44:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id CC5F025071; Tue, 1 Dec 2026 12:44:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796129046; b=wvntQ7NBWEh4lbwWjzT9/M5AdMPyIzI642wzUt0g1CFNcn9O/XoBfd7ChMpbxVC1eUdW A+iwLI39AZJ4V4/S029eD8RceiHBay8zabdRwDxQ/U+ttl6u8Z/o9AKX4nyAORdjLHW2y TSKrb8gEAlwLslzrNnRN+9ZERWtJ5XqLCxXIb9sgZdVfnKX7uriwzMYh2o9McpO8JfmQe Itn5qtSy/uk+EOBDbrrL86Rz/jndLCCntY5hIeajG39Fm9LzPoPyiCbcz/IH4fMEYSm8I FM381qO+rzXF/Z44TUaWR77YLeefPN3NgfStZUo9hTwZFcliO9r2qQUd+fWVka2hKyQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796129046; h=X-Original-To:Received:DMARC-Filter:Received:X-Virus-Scanned: Received:Received:DKIM-Filter:DKIM-Signature:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding:Content-Type:X-ClientProxiedBy; bh=ksq6pJ/Elya3g54xuYtY2Bir7cDCaZJExUAK5yhErfg=; b=nEGLKE9i1JFBip6yHWv0Va13ffF0PpjTBiL5DbRd95DDybSYb4CTVBTskzMXZTsHEpwc BfdXWTrVBaXylxj6JxYroeGMVpTjO9aE2QzMjO4/lDKA0i5K/YZAzrQlk/3Ru4Yks8vY7 x+wa7UbJ3GFPaWKgpGlI7ThzfINizI4PsIbLYIm8jfpn+IqJOKQLgczYmoWD9VmZuY2AV Jko1PFyu0tA/YN7NMU+HMoOjuPhYrwB2c3Zhm5p/R61/TM3GsWEpmS9QfmSi9y3PjubU9 A8qYSvGZ/WeYkT3CLhWBsr/ulPee3hhtVRsLLUjfptjS3o1IT94HEBYzl9ma1hIrJOg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=ypoWENUk; dmarc=pass header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6960B606A68F; Tue, 1 Dec 2026 12:44:06 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=ypoWENUk X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796129045; b=tRIEZ6f8PB/hcCvM6qYr+fj/NpyiRQ/S3JIhFgvKiWCqNwxUnSheMVinCC7/oO0eVGRL JuuIIHFSLmWxD+d8DhmBuT0KRmP/g4PlmWY2bUnDJqVPtVo5w2qBRJxbDdXQLu3S9hL4i LAkrjk2fPYMlPpWzJGPFVUg9yF5torpr9DHW0zHLvdb4qx89ayBMsCmPliOfd0duueTF2 CEEesONET741GF6dSkK/Pw3boJZyPCBA9zUjeQUWEn9Oo6vw3RQ20r9/O94nmVq/Svzdn ot7jmD5EB2f6WdDylFTLX3eFmeg6RUsxWm92nWMWXlZx/rCJzQNkfFi5mdEzs/40d4Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796129045; h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter: DKIM-Signature:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-ClientProxiedBy; bh=ksq6pJ/Elya3g54xuYtY2Bir7cDCaZJExUAK5yhErfg=; b=z2OvGiat+oWoIFmD+hROz9W4Ef8fKniYA2CH2TRLDsql90iPHebEUC9vmXMGTFQ3Wio4 RdxpEtBi+Cx4CyKUpvsF5KHjsMelHy3UzNudLa5ws+vQ1w7pCMY92YE5k46VMcMgdjEGg XDlmgKquPjf6uka4nHKsp0cPH/Wxq5hF0yyuYUq7cea5F0YFwfiH1FwAMcCFIgHCum0LY pXmgVVYEtz0KRgzs5ctd+g6u+wKRXG5h8HXmqbX4fijpjdTRdGAEOWzXPQ5r5ZOay0fUU /QLcGY29lnRvBneqQB65d7E6xv9UNo+3EFHsJ9VxMV4lJvlPICZ/Kn2AL/eeiy63bFQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=ypoWENUk; arc=none smtp.remote-ip=62.96.220.36 X-Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB453606A330 for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 12:44:04 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EB453606A330 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com X-Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id BC1FB207BB; Tue, 1 Dec 2026 13:44:03 +0100 (CET) X-Virus-Scanned: by secunet X-Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j14ho87g0tDj; Tue, 1 Dec 2026 13:44:02 +0100 (CET) X-Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id 534B32085B; Tue, 1 Dec 2026 13:44:02 +0100 (CET) X-DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 534B32085B X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1796129042; bh=ksq6pJ/Elya3g54xuYtY2Bir7cDCaZJExUAK5yhErfg=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=ypoWENUkiUjdyZbsuHN9sVbMJcOdtSfFKw7Z0pr6/JJTLhk0kphh2LgEtVmoayTRr IJP8kLq32pEyg7x1vPBa2p2oPrdiYx386E6pEwVB8jnYvY5qlzyUeKg4czlrvsYhZB F3NpQCbr7CwVIwrTB/3V0gwRYN5r6nQ0WvoWHQY8d2ARKlpdPZsgSGItwNKTONjD4U yb94MB1Slg/Y3S1Lk6/i86O66i5X2tm5WizVs2KgupojS1YofQELuvhtZAnvThvd1V km1wTIdPN/yTWE6GPifr90PWD6WloGi1gOaaHaJPpNuwXZF++ljFgxmfYi0Zw6Cn9b x+a8/y3Pxnv1A== X-Received: from gauss4 (10.182.7.102) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Tue, 1 Dec 2026 13:44:01 +0100 X-Received: (nullmailer pid 1165816 invoked by uid 1000); Tue, 01 Dec 2026 12:43:56 -0000 X-CC: Herbert Xu <herbert@gondor.apana.org.au>, Steffen Klassert <steffen.klassert@secunet.com>, <netdev@vger.kernel.org> X-Mailer: git-send-email 2.53.0 X-In-Reply-To: <20261201124252.1163254-1-steffen.klassert@secunet.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-ClientProxiedBy: EXCH-01.secunet.de (10.32.0.171) To EXCH-01.secunet.de (10.32.0.171)