s390/ctcm: Fix double-kfree
Subsystems (4)
Aswin Karuvally
maintainerPATCH 1/1 s390/ctcm: Fix double-kfree
From: Aleksei Nikiforov <[email protected]>
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.
--- drivers/s390/net/ctcm_mpc.c | 1 - 1 file changed, 1 deletion(-)
drivers/s390/net/ctcm_mpc.c +0 -1
@@ -701,7 +701,6 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo) grp->sweep_req_pend_num--;ctcmpc_send_sweep_resp (ch); -kfree (mpcginfo);return ; }
Signature · 1 line
2.48.1
Quoted 7 lines · Aswin Karuvally
From: Aleksei Nikiforov <[email protected]>
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.
Quoted 8 lines
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 <[email protected]>Signed-off-by Aleksei Nikiforov <[email protected]>Signed-off-by Aswin Karuvally <[email protected]>
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.
...
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 12 Nov 2025 19:27:24 +0100 you wrote:
From: Aleksei Nikiforov <[email protected]>
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.[...]
Here is the summary with links:
- [net-next] s390/ctcm: Fix double-kfree
https://git.kernel.org/netdev/net/c/da02a1824884
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html