aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dumazet <[email protected]>2022-03-25 09:50:21 -0700
committerDavid S. Miller <[email protected]>2022-03-26 14:17:01 -0700
commit5ae6acf1d00be462d7b08b4a8748798ef595ae5a (patch)
treec4ba33377997d857c7db9be424800178fcbfdff2
parent5c7e49be96ea24776a5b5a07c732c477294add00 (diff)
net/smc: fix a memory leak in smc_sysctl_net_exit()
Recently added smc_sysctl_net_exit() forgot to free the memory allocated from smc_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]> Signed-off-by: David S. Miller <[email protected]>
-rw-r--r--net/smc/smc_sysctl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c
index bae19419e755..cf3ab1334c00 100644
--- a/net/smc/smc_sysctl.c
+++ b/net/smc/smc_sysctl.c
@@ -61,5 +61,10 @@ err_alloc:
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);
}