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 --- 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