Skip to content

Commit 5ae6acf

Browse files
edumazetdavem330
authored andcommitted
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: 462791b ("net/smc: add sysctl interface for SMC") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Cc: Tony Lu <tonylu@linux.alibaba.com> Cc: Dust Li <dust.li@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5c7e49b commit 5ae6acf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

net/smc/smc_sysctl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,10 @@ int __net_init smc_sysctl_net_init(struct net *net)
6161

6262
void __net_exit smc_sysctl_net_exit(struct net *net)
6363
{
64+
struct ctl_table *table;
65+
66+
table = net->smc.smc_hdr->ctl_table_arg;
6467
unregister_net_sysctl_table(net->smc.smc_hdr);
68+
if (!net_eq(net, &init_net))
69+
kfree(table);
6570
}

0 commit comments

Comments
 (0)