Re: [PATCH net] net: mctp: free reassembly head skb when key_add fails on SOM
From: Jeremy Kerr
Date: Tue Oct 27 2026 - 20:26:31 EST
Hi Joas,
> > We could just defer setting skb to NULL until the mctp_key_add() has
> > succeeded; there's already the common error path that cleans up any
> > remaining skb.
>
> I think that one needs care. For the first fragment, mctp_frag_queue()
> stores skb_unclone_full(skb) in key->reasm_head, and if skb is a clone,
> skb_unclone_full() frees it and returns a copy. The kfree_skb(skb) at
> out: would then free the original a second time, and the copy in
> reasm_head would still leak. Taking skb back from key->reasm_head on
> failure would work, but the explicit free looked simpler to me.
OK, yep, that makes sense!
Acked-by: Jeremy Kerr <jk@xxxxxxxxxxxxxxxxxxxx>
Cheers,
Jeremy