* [PATCH net] net: wwan: iosm: clear the MUX pointer after freeing the MUX
@ 2026-12-01 14:55 David Westen
2026-12-04 2:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: David Westen @ 2026-12-01 14:55 UTC (permalink / raw)
To: netdev
Cc: loic.poulain, ryazanov.s.a, johannes, andrew+netdev, davem,
edumazet, kuba, pabeni, m.chetan.kumar, mail
ipc_imem_cleanup() frees the MUX but leaves ipc_imem->mux pointing at
it, so closing a netdev that is still up uses the freed MUX:
BUG: KASAN: slab-use-after-free in ipc_mux_close_session
Call Trace:
ipc_mux_close_session
ipc_wwan_link_stop
__dev_close_many
wwan_unregister_ops
ipc_wwan_deinit
ipc_imem_cleanup
ipc_pcie_remove
Clear the pointer after the free; ipc_imem_sys_wwan_close() already
skips the session close when it is NULL. Do the same in the error path
of the run state worker.
Reproduced with KASAN on an XMM7360 by unbinding the driver while
wwan0 is up. With this change, two such unbinds show no report.
Fixes: 3670970dd8c6 ("net: iosm: shared memory IPC interface")
Fixes: 60829145f1e2 ("net: wwan: iosm: fix NULL pointer dereference when removing device")
Signed-off-by: David Westen <davidlwesten@gmail.com>
---
Previously sent as patch 1/2 of a series:
https://lore.kernel.org/netdev/20261126194143.32283-1-davidlwesten@gmail.com/
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 4405c8531888..998493b730b0 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_imem.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_imem.c
@@ -635,6 +635,7 @@ static void ipc_imem_run_state_worker(struct work_struct *instance)
err_ipc_mux_deinit:
ipc_mux_deinit(ipc_imem->mux);
+ ipc_imem->mux = NULL;
err_out:
ipc_uevent_send(ipc_imem->dev, UEVENT_CD_READY_LINK_DOWN);
}
@@ -1245,6 +1246,7 @@ void ipc_imem_cleanup(struct iosm_imem *ipc_imem)
if (test_and_clear_bit(FULLY_FUNCTIONAL, &ipc_imem->flag)) {
ipc_mux_deinit(ipc_imem->mux);
+ ipc_imem->mux = NULL;
ipc_debugfs_deinit(ipc_imem);
ipc_wwan_deinit(ipc_imem->wwan);
ipc_port_deinit(ipc_imem->ipc_port);
--
2.56.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: wwan: iosm: clear the MUX pointer after freeing the MUX
2026-12-01 14:55 [PATCH net] net: wwan: iosm: clear the MUX pointer after freeing the MUX David Westen
@ 2026-12-04 2:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-12-04 2:40 UTC (permalink / raw)
To: David Westen
Cc: netdev, loic.poulain, ryazanov.s.a, johannes, andrew+netdev,
davem, edumazet, kuba, pabeni, m.chetan.kumar, mail
Hello:
This patch was applied to netdev/net-next.git (main)
by Willem de Bruijn <willemb@google.com>:
On Tue, 1 Dec 2026 06:55:53 -0800 you wrote:
> ipc_imem_cleanup() frees the MUX but leaves ipc_imem->mux pointing at
> it, so closing a netdev that is still up uses the freed MUX:
>
> BUG: KASAN: slab-use-after-free in ipc_mux_close_session
> Call Trace:
> ipc_mux_close_session
> ipc_wwan_link_stop
> __dev_close_many
> wwan_unregister_ops
> ipc_wwan_deinit
> ipc_imem_cleanup
> ipc_pcie_remove
>
> [...]
Here is the summary with links:
- [net] net: wwan: iosm: clear the MUX pointer after freeing the MUX
https://git.kernel.org/netdev/net-next/c/162373b54c7c
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-12-04 2:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 14:55 [PATCH net] net: wwan: iosm: clear the MUX pointer after freeing the MUX David Westen
2026-12-04 2:40 ` 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