* [PATCH ipsec] xfrm: iptfs: free the first skb on checksum error
@ 2026-11-29 16:18 Andrii Tereshchenko
0 siblings, 0 replies; only message in thread
From: Andrii Tereshchenko @ 2026-11-29 16:18 UTC (permalink / raw)
To: Steffen Klassert, Herbert Xu, David S. Miller
Cc: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Willem de Bruijn,
Simon Horman, Christian Hopps, netdev, ipsec, linux-kernel,
Andrii Tereshchenko, stable
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-29 16:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 16:18 [PATCH ipsec] xfrm: iptfs: free the first skb on checksum error Andrii Tereshchenko
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®