net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
Subsystems (5)
PATCH 1/1 net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
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.
--- drivers/net/wwan/iosm/iosm_ipc_mux.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wwan/iosm/iosm_ipc_mux.c +6 -0
@@ -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); }
Signature · 1 line
2.34.1
Quoted 6 lines · Zilin Guan
Commit
1f52d7b62285("net: wwan: iosm: Enable M.2 7360 WWAN card support") allocated memory forpp_qltinipc_mux_init()but did not free it inipc_mux_deinit(). This results in a memory leak when the driver is unloaded.
Quoted 6 lines
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 <[email protected]>Signed-off-by Jianhao Xu <[email protected]>Signed-off-by Zilin Guan <[email protected]>
Quoted 30 lines
--- drivers/net/wwan/iosm/iosm_ipc_mux.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/net/wwan/iosm/iosm_ipc_mux.c +6
-1@@ -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
…
drivers/net/wwan/iosm/iosm_ipc_mux.c void ipc_mux_deinit(struct iosm_mux *ipc_mux) · line 459
Quoted 6 lines
+++
b/drivers/net/wwan/iosm/iosm_ipc_mux.cdrivers/net/wwan/iosm/iosm_ipc_mux.c +1
-0@@ -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
Quoted 9 lines · Markus Elfring
…
Quoted 6 lines
+++
b/drivers/net/wwan/iosm/iosm_ipc_mux.cdrivers/net/wwan/iosm/iosm_ipc_mux.c +1
-0@@ -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;…
Quoted 4 lines
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
Quoted 10 lines
Quoted 10 lines
…
drivers/net/wwan/iosm/iosm_ipc_mux.c void ipc_mux_deinit(struct iosm_mux *ipc_mux) · line 459
Quoted 6 lines
+++
b/drivers/net/wwan/iosm/iosm_ipc_mux.cdrivers/net/wwan/iosm/iosm_ipc_mux.c +1
-0@@ -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?
…
Quoted 3 lines
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?
Quoted 3 lines
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
Quoted 4 lines · Markus Elfring
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
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 Tue, 30 Dec 2025 07:18:53 +0000 you wrote:
Commit
1f52d7b62285("net: wwan: iosm: Enable M.2 7360 WWAN card support") allocated memory forpp_qltinipc_mux_init()but did not free it inipc_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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html