netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] s390/ctcm: Fix double-kfree
@ 2025-11-12 18:27 Aswin Karuvally
  2025-11-17 14:53 ` Simon Horman
  2025-11-18  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Aswin Karuvally @ 2025-11-12 18:27 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	Andrew Lunn
  Cc: netdev, linux-s390, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Alexandra Winter, Christian Borntraeger,
	Sven Schnelle, Simon Horman, Aleksei Nikiforov

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>
---
 drivers/s390/net/ctcm_mpc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c
index 0aeafa772fb1..407b7c516658 100644
--- a/drivers/s390/net/ctcm_mpc.c
+++ b/drivers/s390/net/ctcm_mpc.c
@@ -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;
 }
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] s390/ctcm: Fix double-kfree
  2025-11-12 18:27 [PATCH net-next] s390/ctcm: Fix double-kfree Aswin Karuvally
@ 2025-11-17 14:53 ` Simon Horman
  2025-11-18  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-11-17 14:53 UTC (permalink / raw)
  To: Aswin Karuvally
  Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	Andrew Lunn, netdev, linux-s390, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Alexandra Winter, Christian Borntraeger,
	Sven Schnelle, Aleksei Nikiforov

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>

...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] s390/ctcm: Fix double-kfree
  2025-11-12 18:27 [PATCH net-next] s390/ctcm: Fix double-kfree Aswin Karuvally
  2025-11-17 14:53 ` Simon Horman
@ 2025-11-18  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-18  1:10 UTC (permalink / raw)
  To: Aswin Karuvally
  Cc: davem, kuba, pabeni, edumazet, andrew+netdev, netdev, linux-s390,
	hca, gor, agordeev, wintera, borntraeger, svens, horms,
	aleksei.nikiforov

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 12 Nov 2025 19:27:24 +0100 you 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.
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-18  1:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-12 18:27 [PATCH net-next] s390/ctcm: Fix double-kfree Aswin Karuvally
2025-11-17 14:53 ` Simon Horman
2025-11-18  1:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).