net/smc: fix a memory leak in smc_sysctl_net_exit()
PATCH 1/1 net/smc: fix a memory leak in smc_sysctl_net_exit()
From: Eric Dumazet <[email protected]>
Recently added smc_sysctl_net_exit() forgot to free the memory allocated from smc_sysctl_net_init() for non initial network namespace.
--- net/smc/smc_sysctl.c | 5 +++++ 1 file changed, 5 insertions(+)
net/smc/smc_sysctl.c +5 -0
@@ -61,5 +61,10 @@ int __net_init smc_sysctl_net_init(struct net *net) void __net_exit smc_sysctl_net_exit(struct net *net) { +struct ctl_table *table; + + table = net->smc.smc_hdr->ctl_table_arg;unregister_net_sysctl_table (net->smc.smc_hdr); +if (!net_eq (net, &init_net)) +kfree (table); }
Signature · 1 line
2.35.1.1021.g381101b075-goog
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 6 lines · On Fri, 25 Mar 2022 09:50:21 -0700 you wrote:
From: Eric Dumazet <[email protected]>
Recently added
smc_sysctl_net_exit()forgot to free the memory allocated fromsmc_sysctl_net_init()for non initial network namespace.
Quoted 7 lines
Fixes 462791bbfa35 ("net/smc: add sysctl interface for SMC")Signed-off-by Eric Dumazet <[email protected]>Reported-by syzbot <[email protected]>Cc Tony Lu <[email protected]>Cc Dust Li <[email protected]>[...]
Here is the summary with links:
- [net] net/smc: fix a memory leak in smc_sysctl_net_exit()
https://git.kernel.org/netdev/net/c/5ae6acf1d00b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Tony Lu
reviewerQuoted 20 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
Recently added
smc_sysctl_net_exit()forgot to free the memory allocated fromsmc_sysctl_net_init()for non initial network namespace.Fixes 462791bbfa35 ("net/smc: add sysctl interface for SMC")Signed-off-by Eric Dumazet <[email protected]>Reported-by syzbot <[email protected]>Cc Tony Lu <[email protected]>Cc Dust Li <[email protected]>--- net/smc/smc_sysctl.c | 5 +++++ 1 file changed, 5 insertions(+)net/smc/smc_sysctl.c +0
-0
net/smc/smc_sysctl.c int __net_init smc_sysctl_net_init(struct net *net) · line 70
Quoted 10 lines
net/smc/smc_sysctl.c +5
-0@@ -61,5 +61,10 @@ int __net_init smc_sysctl_net_init(struct net *net) void __net_exit smc_sysctl_net_exit(struct net *net) { +struct ctl_table *table; + + table = net->smc.smc_hdr->ctl_table_arg;unregister_net_sysctl_table (net->smc.smc_hdr); +if (!net_eq (net, &init_net)) +kfree (table); }
Thanks a lot for fixing this issue, this is my fault.
Tony Lu