Re: [PATCH net-next] s390/ctcm: Fix double-kfree

Simon Horman
2025-11-17T14:53:36Z

On Wed, Nov 12, 2025 at 07:27:24PM +0100, Aswin Karuvally wrote:
> From: Aleksei Nikiforov <aleksei.nikiforov@linux.ibm.com>
>
> The function 'mpc_rcvd_sweep_req(mpcginfo)' is called conditionally
> from function 'ctcmpc_unpack_skb'. It frees passed mpcginfo.
> After that a call to function 'kfree' in function 'ctcmpc_unpack_skb'
> frees it again.
>
> Remove 'kfree' call in function 'mpc_rcvd_sweep_req(mpcginfo)'.
>
> Bug detected by the clang static analyzer.
>
> Fixes: 0c0b20587b9f25a2 ("s390/ctcm: fix potential memory leak")
> Reviewed-by: Aswin Karuvally <aswin@linux.ibm.com>
> Signed-off-by: Aleksei Nikiforov <aleksei.nikiforov@linux.ibm.com>
> Signed-off-by: Aswin Karuvally <aswin@linux.ibm.com>

Thanks,

I agree with this analysis.
And this change brings mpc_rcvd_sweep_req()
into line with other functions that ctcmpc_unpack_skb()
passes mpcginfo - they don't free it either.

Reviewed-by: Simon Horman <horms@kernel.org>

...