* [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
@ 2025-12-30 7:18 Zilin Guan
2025-12-30 8:31 ` Loic Poulain
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Zilin Guan @ 2025-12-30 7:18 UTC (permalink / raw)
To: loic.poulain
Cc: ryazanov.s.a, johannes, andrew+netdev, davem, edumazet, kuba,
pabeni, netdev, linux-kernel, Zilin Guan, Jianhao Xu
Commit 1f52d7b62285 ("net: wwan: iosm: Enable M.2 7360 WWAN card support")
allocated memory for pp_qlt in ipc_mux_init() but did not free it in
ipc_mux_deinit(). This results in a memory leak when the driver is
unloaded.
Free the allocated memory in ipc_mux_deinit() to fix the leak.
Fixes: 1f52d7b62285 ("net: wwan: iosm: Enable M.2 7360 WWAN card support")
Co-developed-by: Jianhao Xu <jianhao.xu@seu.edu.cn>
Signed-off-by: Jianhao Xu <jianhao.xu@seu.edu.cn>
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
---
drivers/net/wwan/iosm/iosm_ipc_mux.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux.c b/drivers/net/wwan/iosm/iosm_ipc_mux.c
index fc928b298a98..b846889fcb09 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_mux.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_mux.c
@@ -456,6 +456,7 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux)
struct sk_buff_head *free_list;
union mux_msg mux_msg;
struct sk_buff *skb;
+ int i;
if (!ipc_mux->initialized)
return;
@@ -479,5 +480,10 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux)
ipc_mux->channel->dl_pipe.is_open = false;
}
+ if (ipc_mux->protocol != MUX_LITE) {
+ for (i = 0; i < IPC_MEM_MUX_IP_SESSION_ENTRIES; i++)
+ kfree(ipc_mux->ul_adb.pp_qlt[i]);
+ }
+
kfree(ipc_mux);
}
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
2025-12-30 7:18 [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit() Zilin Guan
@ 2025-12-30 8:31 ` Loic Poulain
2025-12-30 9:15 ` Markus Elfring
2026-01-04 19:12 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 7+ messages in thread
From: Loic Poulain @ 2025-12-30 8:31 UTC (permalink / raw)
To: Zilin Guan
Cc: ryazanov.s.a, johannes, andrew+netdev, davem, edumazet, kuba,
pabeni, netdev, linux-kernel, Jianhao Xu
On Tue, Dec 30, 2025 at 8:19 AM Zilin Guan <zilin@seu.edu.cn> wrote:
>
> Commit 1f52d7b62285 ("net: wwan: iosm: Enable M.2 7360 WWAN card support")
> allocated memory for pp_qlt in ipc_mux_init() but did not free it in
> ipc_mux_deinit(). This results in a memory leak when the driver is
> unloaded.
>
> Free the allocated memory in ipc_mux_deinit() to fix the leak.
>
> Fixes: 1f52d7b62285 ("net: wwan: iosm: Enable M.2 7360 WWAN card support")
> Co-developed-by: Jianhao Xu <jianhao.xu@seu.edu.cn>
> Signed-off-by: Jianhao Xu <jianhao.xu@seu.edu.cn>
> Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
> ---
> drivers/net/wwan/iosm/iosm_ipc_mux.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux.c b/drivers/net/wwan/iosm/iosm_ipc_mux.c
> index fc928b298a98..b846889fcb09 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_mux.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_mux.c
> @@ -456,6 +456,7 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux)
> struct sk_buff_head *free_list;
> union mux_msg mux_msg;
> struct sk_buff *skb;
> + int i;
>
> if (!ipc_mux->initialized)
> return;
> @@ -479,5 +480,10 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux)
> ipc_mux->channel->dl_pipe.is_open = false;
> }
>
> + if (ipc_mux->protocol != MUX_LITE) {
> + for (i = 0; i < IPC_MEM_MUX_IP_SESSION_ENTRIES; i++)
> + kfree(ipc_mux->ul_adb.pp_qlt[i]);
> + }
> +
> kfree(ipc_mux);
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
2025-12-30 7:18 [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit() Zilin Guan
2025-12-30 8:31 ` Loic Poulain
@ 2025-12-30 9:15 ` Markus Elfring
2025-12-30 9:25 ` Zilin Guan
2026-01-04 19:12 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2025-12-30 9:15 UTC (permalink / raw)
To: Jianhao Xu, Zilin Guan, netdev, Loic Poulain
Cc: LKML, kernel-janitors, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Johannes Berg, Paolo Abeni,
Sergey Ryazanov
…
> +++ b/drivers/net/wwan/iosm/iosm_ipc_mux.c
> @@ -456,6 +456,7 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux)
> struct sk_buff_head *free_list;
> union mux_msg mux_msg;
> struct sk_buff *skb;
> + int i;
…
May this variable be defined in the loop header instead?
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
2025-12-30 9:15 ` Markus Elfring
@ 2025-12-30 9:25 ` Zilin Guan
2025-12-30 9:42 ` Markus Elfring
0 siblings, 1 reply; 7+ messages in thread
From: Zilin Guan @ 2025-12-30 9:25 UTC (permalink / raw)
To: markus.elfring
Cc: andrew+netdev, davem, edumazet, jianhao.xu, johannes,
kernel-janitors, kuba, linux-kernel, loic.poulain, netdev,
pabeni, ryazanov.s.a, zilin
On Tue, Dec 30, 2025 at 10:15:05AM+0100, Markus Elfring wrote:
> …
> > +++ b/drivers/net/wwan/iosm/iosm_ipc_mux.c
> > @@ -456,6 +456,7 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux)
> > struct sk_buff_head *free_list;
> > union mux_msg mux_msg;
> > struct sk_buff *skb;
> > + int i;
> …
>
> May this variable be defined in the loop header instead?
>
> Regards,
> Markus
Thanks for the suggestion.
I would prefer to keep the declaration at the top of the block to maintain
consistency with the existing coding style of this function and to keep
the patch focused strictly on the fix.
Regards,
Zilin Guan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
2025-12-30 9:25 ` Zilin Guan
@ 2025-12-30 9:42 ` Markus Elfring
2025-12-30 11:04 ` Zilin Guan
0 siblings, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2025-12-30 9:42 UTC (permalink / raw)
To: Jianhao Xu, Zilin Guan, netdev
Cc: LKML, kernel-janitors, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Johannes Berg, Loic Poulain,
Paolo Abeni, Sergey Ryazanov
>> …
>>> +++ b/drivers/net/wwan/iosm/iosm_ipc_mux.c
>>> @@ -456,6 +456,7 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux)
>>> struct sk_buff_head *free_list;
>>> union mux_msg mux_msg;
>>> struct sk_buff *skb;
>>> + int i;
>> …
>>
>> May this variable be defined in the loop header instead?
…
> Thanks for the suggestion.
>
> I would prefer to keep the declaration at the top of the block
Do you tend to interpret such information still as the beginning
of the function implementation?
> to maintain
> consistency with the existing coding style of this function and to keep
> the patch focused strictly on the fix.
Would the mentioned variable be relevant only for an additional if branch?
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
2025-12-30 9:42 ` Markus Elfring
@ 2025-12-30 11:04 ` Zilin Guan
0 siblings, 0 replies; 7+ messages in thread
From: Zilin Guan @ 2025-12-30 11:04 UTC (permalink / raw)
To: markus.elfring
Cc: andrew+netdev, davem, edumazet, jianhao.xu, johannes,
kernel-janitors, kuba, linux-kernel, loic.poulain, netdev,
pabeni, ryazanov.s.a, zilin
On Tue, Dec 30, 2025 at 10:42:22AM+0100, Markus Elfring wrote:
> Do you tend to interpret such information still as the beginning
> of the function implementation?
> ...
> Would the mentioned variable be relevant only for an additional if branch?
I prefer to strictly follow the existing coding style of the current file,
where all local variables are declared at the top of the function. I do
not wish to mix different declaration styles in this patch.
If you believe the file should be converted to C99 style, that would be
better handled in a separate cleanup patch for the entire file, rather
than mixing it into this bug fix.
Regards,
Zilin Guan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
2025-12-30 7:18 [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit() Zilin Guan
2025-12-30 8:31 ` Loic Poulain
2025-12-30 9:15 ` Markus Elfring
@ 2026-01-04 19:12 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-04 19:12 UTC (permalink / raw)
To: Zilin Guan
Cc: loic.poulain, ryazanov.s.a, johannes, andrew+netdev, davem,
edumazet, kuba, pabeni, netdev, linux-kernel, jianhao.xu
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 30 Dec 2025 07:18:53 +0000 you wrote:
> Commit 1f52d7b62285 ("net: wwan: iosm: Enable M.2 7360 WWAN card support")
> allocated memory for pp_qlt in ipc_mux_init() but did not free it in
> ipc_mux_deinit(). This results in a memory leak when the driver is
> unloaded.
>
> Free the allocated memory in ipc_mux_deinit() to fix the leak.
>
> [...]
Here is the summary with links:
- [net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
https://git.kernel.org/netdev/net/c/92e6e0a87f68
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] 7+ messages in thread
end of thread, other threads:[~2026-01-04 19:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-30 7:18 [PATCH net] net: wwan: iosm: Fix memory leak in ipc_mux_deinit() Zilin Guan
2025-12-30 8:31 ` Loic Poulain
2025-12-30 9:15 ` Markus Elfring
2025-12-30 9:25 ` Zilin Guan
2025-12-30 9:42 ` Markus Elfring
2025-12-30 11:04 ` Zilin Guan
2026-01-04 19:12 ` 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
all inboxes | Powered by JetHome®