Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] net: wwan: iosm: fix potential memory leaks in ipc_imem_init()
@ 2026-05-19  6:27 Abdun Nihaal
  2026-05-21 15:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Abdun Nihaal @ 2026-05-19  6:27 UTC (permalink / raw)
  To: loic.poulain
  Cc: Abdun Nihaal, ryazanov.s.a, johannes, andrew+netdev, davem,
	edumazet, kuba, pabeni, netdev, linux-kernel, stable

The memory allocated in ipc_protocol_init() is not freed on the error
paths that follow in ipc_imem_init(). Fix that by calling the
corresponding release function ipc_protocol_deinit() in the error path.

Fixes: 3670970dd8c6 ("net: iosm: shared memory IPC interface")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
v1->v2:
- Moved the ipc_protocol_deinit() call to a point after the tasklets and
  workers are cleaned up to avoid a possible Use after free, as
  suggested by Jakub Kicinski.

Link to v1 patch: https://lore.kernel.org/all/20260508092141.82495-1-nihaal@cse.iitm.ac.in/

 drivers/net/wwan/iosm/iosm_ipc_imem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem.c b/drivers/net/wwan/iosm/iosm_ipc_imem.c
index 1b7bc7d63a2e..4405c8531888 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_imem.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_imem.c
@@ -1425,6 +1425,8 @@ struct iosm_imem *ipc_imem_init(struct iosm_pcie *pcie, unsigned int device_id,
 protocol_init_fail:
 	cancel_work_sync(&ipc_imem->run_state_worker);
 	ipc_task_deinit(ipc_imem->ipc_task);
+	if (ipc_imem->ipc_protocol)
+		ipc_protocol_deinit(ipc_imem->ipc_protocol);
 ipc_task_init_fail:
 	kfree(ipc_imem->ipc_task);
 ipc_task_fail:
-- 
2.43.0


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

* Re: [PATCH net v2] net: wwan: iosm: fix potential memory leaks in ipc_imem_init()
  2026-05-19  6:27 [PATCH net v2] net: wwan: iosm: fix potential memory leaks in ipc_imem_init() Abdun Nihaal
@ 2026-05-21 15:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-21 15:20 UTC (permalink / raw)
  To: Abdun Nihaal
  Cc: loic.poulain, ryazanov.s.a, johannes, andrew+netdev, davem,
	edumazet, kuba, pabeni, netdev, linux-kernel, stable

Hello:

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

On Tue, 19 May 2026 11:57:39 +0530 you wrote:
> The memory allocated in ipc_protocol_init() is not freed on the error
> paths that follow in ipc_imem_init(). Fix that by calling the
> corresponding release function ipc_protocol_deinit() in the error path.
> 
> Fixes: 3670970dd8c6 ("net: iosm: shared memory IPC interface")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
> 
> [...]

Here is the summary with links:
  - [net,v2] net: wwan: iosm: fix potential memory leaks in ipc_imem_init()
    https://git.kernel.org/netdev/net/c/c5d93b2c4035

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] 2+ messages in thread

end of thread, other threads:[~2026-05-21 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19  6:27 [PATCH net v2] net: wwan: iosm: fix potential memory leaks in ipc_imem_init() Abdun Nihaal
2026-05-21 15:20 ` 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