From: Andrii Tereshchenko <opensource@andrii.net>
To: Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>,
Simon Horman <horms@kernel.org>,
Christian Hopps <chopps@labn.net>,
netdev@vger.kernel.org, ipsec@lists.linux.dev,
linux-kernel@vger.kernel.org,
Andrii Tereshchenko <opensource@andrii.net>,
stable@vger.kernel.org
Subject: [PATCH ipsec] xfrm: iptfs: free the first skb on checksum error
Date: Sun, 29 Nov 2026 09:18:52 -0700 [thread overview]
Message-ID: <3cb0955a-5a30-4c85-b032-c9a829131406@mid.andrii.net> (raw)
iptfs_first_skb() returns a skb_checksum_help() error without freeing
the dequeued skb, and its caller moves on: the skb leaks, with its dst
and socket reference. Commit 8579d342ea2b ("xfrm: iptfs: add
fragmenting of larger than MTU user packets") moved this check out of
iptfs_output_queued() and dropped its kfree_skb().
Free it and count the error, as the other error paths do.
The patch was written with an AI coding assistant and reviewed by the
submitter.
Fixes: 8579d342ea2b ("xfrm: iptfs: add fragmenting of larger than MTU user packets")
Cc: stable@vger.kernel.org
Signed-off-by: Andrii Tereshchenko <opensource@andrii.net>
---
Found by an AI code review agent. Validated with fault injection:
failslab failing allocations under skb_checksum_help() while TCP
sendfile() traffic crosses an IP-TFS tunnel. Tested the same way with
kmemleak: the skbs leak without this patch (3 boots) and nothing leaks
with it (2 boots, KASAN, panic_on_warn=1). A selftest doing this is
available; it needs kmemleak and failslab, so I left it out.
net/xfrm/xfrm_iptfs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_iptfs.c b/net/xfrm/xfrm_iptfs.c
index 76272b0a18296..24f2f25ec4fdc 100644
--- a/net/xfrm/xfrm_iptfs.c
+++ b/net/xfrm/xfrm_iptfs.c
@@ -2132,8 +2132,11 @@ static int iptfs_first_skb(struct sk_buff **skbp, struct xfrm_iptfs_data *xtfs,
/* The opportunity for HW offload has ended */
if (skb->ip_summed == CHECKSUM_PARTIAL) {
err = skb_checksum_help(skb);
- if (err)
+ if (err) {
+ XFRM_INC_STATS(xs_net(xtfs->x), LINUX_MIB_XFRMOUTERROR);
+ kfree_skb(skb);
return err;
+ }
}
/* We've split gso up before queuing */
base-commit: 1213df0bc5993e479706c5eba5830243d778f164
--
2.53.0
reply other threads:[~2026-11-29 16:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3cb0955a-5a30-4c85-b032-c9a829131406@mid.andrii.net \
--to=opensource@andrii.net \
--cc=chopps@labn.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=ipsec@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®