Commit 5ae6acf1 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

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: 462791bb ("net/smc: add sysctl interface for SMC")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
Cc: Tony Lu <tonylu@linux.alibaba.com>
Cc: Dust Li <dust.li@linux.alibaba.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5c7e49be
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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);
}