Article View: linux.kernel.netdev
Article #8824[PATCH net] xfrm: iptfs: fix skb leak on error in __input_process_payload()
From: Eric Dumazet
Date: Fri, 30 Oct 2026 08:33
Date: Fri, 30 Oct 2026 08:33
54 lines
9686 bytes
9686 bytes
syzbot reported a memory leak of the received skb (and its sec_path
extension) in the IP-TFS receive path.
__input_process_payload() parses the inner packets of an IP-TFS payload
and queues them on @sublist, which is only sent after the parsing loop.
Three error paths inside the loop (skb_copy_seq_read() failure, invalid
inner IPv4 header length, unknown IP version) jump to the "done" label,
which is placed after the code sending @sublist.
Any skb already queued on @sublist is then neither delivered nor freed.
This includes skbs added by iptfs_reassem_cont() before the call, newly
allocated inner packets, and, since the received skb can be reused for
the first inner packet, the received skb itself.
Move the "done" label before the trim/send code, so that inner packets
parsed before the error are delivered as on the normal exit path. The
received skb is then still freed (or consumed) as before when it was
not reused.
Fixes: 6c82d2433671 ("xfrm: iptfs: add basic receive packet (tunnel egress) handling")
Reported-by: syzbot+a3f21220cbbb6e14ee2e@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6ae4102e.9c6421ad.36baac.0005.GAE@google.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
---
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
net/xfrm/xfrm_iptfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_iptfs.c b/net/xfrm/xfrm_iptfs.c
index 103cf7c5dbfb..0313a43aa8a9 100644
--- a/net/xfrm/xfrm_iptfs.c
+++ b/net/xfrm/xfrm_iptfs.c
@@ -1182,6 +1182,7 @@ static bool __input_process_payload(struct xfrm_state *x, u32 data,
/* this should not happen from the above code */
XFRM_INC_STATS(net, LINUX_MIB_XFRMINIPTFSERROR);
+done:
if (first_skb && first_iplen && !defer && !first_skb_partial) {
/* first_skb is queued b/c !defer and not partial */
if (pskb_trim(first_skb, first_iplen)) {
@@ -1198,7 +1199,7 @@ static bool __input_process_payload(struct xfrm_state *x, u32 data,
if (xfrm_input(skb, 0, 0, -2))
kfree_skb(skb);
}
-done:
+
skb = skbseq->root_skb;
skb_abort_seq_read(skbseq);
--
2.53.0
Technical Details
Message-ID:
<20261030083358.2653599-1-edumazet@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353657-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353657-linux-kernel-netdev=dewy.ru From: edumazet@kernel.org (Eric Dumazet) Newsgroups: linux.kernel.netdev Subject: [PATCH net] xfrm: iptfs: fix skb leak on error in __input_process_payload() Date: Fri, 30 Oct 2026 09:33:58 +0100 Organization: Usenet Network Message-ID: <20261030083358.2653599-1-edumazet@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2192655"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:+zyAuQpCZyA7ZRcMuJVo/JSPAVc= sha256:/2oD+Z/xptDivmAZ4vZ8Bp468/SHbkbLN7WMf+RbIkA= sha1:vT79vSusxY4JCKO1V3K4aYIG+B8= sha256:oFruTnxehtZD2GL59mK2zTD3L32tAbpdfmzrk9nE2tY= 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 84492125C8A; Fri, 30 Oct 2026 11:39:20 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 7MvBWlHVmpWS; Fri, 30 Oct 2026 11:39:13 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-353657-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id C0621125C89; Fri, 30 Oct 2026 11:39:04 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 7DDC9302BC; Fri, 30 Oct 2026 08:34:04 +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=1793349244; b=LzCDet6asEWvpt8g/vdbINXWwZdon1szOW+kemLoUiPBwlDfFfEuUC3koQye7P0NhvIp yrrYtRWAzRJxHMNGPmURelpwoA6kLdX4wVzMEIAlrCy9JcQrxiviG4G/gtGcax429SijK XwaTHc1MCddacFrMPPPn2vSeUFolyjktE9JmKybCNLw5+qcsFFu8s7R9VEnZvzrF/58Nw R8Q6/+0agki4jsIMB9wGK1yprSjesD6sKzvZJcRwrZZzTh2JRqPUpLe/5d/o9m3Dzxztd d3aL4NAv9AymvQ1yfk/VzYtOsLvTKeGv9wMpPG2c5kDSP1M8YeNsRuYbqeYgkejz0Tw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793349244; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=rwq7g9L7G/Q+SxSTNvORYifWRqmPbMTkylWUOWvbZS4=; b=nYFldlz80eTlcUjHG3l0/Vt75G5BOkHC9bmliODpNb4g9+7lRT1ZJX2zYyLRoUbP5fCP A2G826X7vXWh49KP3hFZodc4jN1SaqlkjVGNuuW2W4ioLihfdHk8pd5dDhp//tM7b2EJ/ rIT99NS3XHvZOPuwijhE1MT6L9tAiH+5YQ4aqr550NTtQy5ytCfLHKu+Dhx0tKAweUXSx 3qLbxqeJ3/xaN5JzCDYl1Ox2XGadhO2coYCPPd7/6va5Jimgay0jW3q0QoGSWqKFbvKrs hA9ngXFOx1qUrfnH4AV7Md75W5sjcAKktgnJ2SmmvDs2RLqkQbd1fetdwZ1EjKh0kmA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gi2TsWLq; 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 4C764606A326; Fri, 30 Oct 2026 08:34:04 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gi2TsWLq X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793349243; b=mjCNGhkr5TGC7wFk8Ynf1PaoajzurvNJBygAyU28iURJdLBx2CCpRwYcFdEA5uWthAeb Mfv+eLrQ0bNlAgXY7dMtMkcS+WO+qsCjomboWm74C7x5soqe6aYv6nKvWKCInU8UP2XTs AdTy7Y4wnTgdU1KXc98n3mdeh3CibNxFVJmRtFYY6qO16N+Wo8jmbXHQxoBM7ck9ZM2Tu Fb5zE6tnJMd6Va3zIi3ZE8gXnmykm1srwNxA/Y/k82e6I5DoreSSA2fqNFr6h3W9og0Ma thFjkCNoqT7t6btbWP3FSH1nYs/CHk2LIsJAwc2lXYxcDPldtJo0ycRvld/QI3abhzg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793349243; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=rwq7g9L7G/Q+SxSTNvORYifWRqmPbMTkylWUOWvbZS4=; b=G9xF3uZFt4IPmk3POH5pmqXwjJrWwwN9uZ1ALM4J72bJKdFj+/pMGJkG2sR10GFJawV2 WqkEckP7ZE/ItiJ3yEj9YujTmXyYjsXbiMPIsOj/w2hK7WW33byUyaZi5jCmfMfYxRMN2 cxh/VS1JkM+5BplurFbqVHO8uqy0jC7g9puNHo75NOJqRRwZ4or34N2MoWvuq28gQQZ1V wdEaDpW1+TVTBbA5Dk9UptZMX8lmGzBb/UH5iJpSYeruyxnzg8KDU7VVGBEzy0f8+Nn6t Zw5nsxZWCKAl494IJBbvkfZbFEBiZ1ySQ+K/9j4Skv3cm0052gHBD8zxi6gdqFUSbLw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gi2TsWLq; arc=none smtp.remote-ip=100.103.45.18 X-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 2A06B606A31F for <netdev@vger.kernel.org>; Fri, 30 Oct 2026 08:34:02 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA2F71F00A20; Fri, 30 Oct 2026 08:34:00 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793349242; bh=rwq7g9L7G/Q+SxSTNvORYifWRqmPbMTkylWUOWvbZS4=; h=From:To:Cc:Subject:Date; b=gi2TsWLqNSBUhuYI5wBGndnHEBu20e1mX8wdasuGNGtmvFe6cGCz6g6niRHSKs2uG RSV1kV+3tpKAYqsTlpFLNIJOdy1fz3QgWCFmHnlJIXFFs34xLrND881MX/txkLUFua 7bwvp94NBDEz6CybPIAIdnhA58RZiq9f3R4kOLP7z4mtwbIYTANM26nFIAgy7ygx0j HJ3j0AEbgjpMHwKKyyiPugBNXboWcr7th0ZlJvfJxgcswn0yKei3fPNnF0Dp7Y7bBz mlYHG8DnLs6ProgmRn5rDHJAcmL7LIkf6DwO6EE0kCl1jE8VEaWYgvtegsg686yjwC CEojzdWndfAxw== X-Cc: Simon Horman <horms@kernel.org>, netdev@vger.kernel.org, edumazet@kernel.org, syzbot+a3f21220cbbb6e14ee2e@syzkaller.appspotmail.com, Steffen Klassert <steffen.klassert@secunet.com>, Herbert Xu <herbert@gondor.apana.org.au> X-Mailer: git-send-email 2.53.0 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