From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36 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== 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== 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 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 ; Tue, 1 Dec 2026 12:44:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EB453606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com 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 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 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) 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) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 534B32085B 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== 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 Received: (nullmailer pid 1165816 invoked by uid 1000); Tue, 01 Dec 2026 12:43:56 -0000 From: Steffen Klassert To: David Miller , Jakub Kicinski CC: Herbert Xu , Steffen Klassert , Subject: [PATCH 16/22] xfrm: iptfs: make room before copying a continuation in reassembly Date: Tue, 1 Dec 2026 13:41:42 +0100 Message-ID: <20261201124252.1163254-17-steffen.klassert@secunet.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261201124252.1163254-1-steffen.klassert@secunet.com> References: <20261201124252.1163254-1-steffen.klassert@secunet.com> X-Mailing-List: netdev@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 Content-Type: text/plain X-ClientProxiedBy: EXCH-01.secunet.de (10.32.0.171) To EXCH-01.secunet.de (10.32.0.171) From: Andrii Tereshchenko 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: 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 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 Reviewed-by: Fernando Fernandez Mancera Signed-off-by: Steffen Klassert --- 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