
mainline inclusion from mainline-v5.18-rc1 commit 5ae6acf1d00be462d7b08b4a8748798ef595ae5a category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I76JHC CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/ne... -------------------------------- 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 <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> Signed-off-by: Litao Jiao <jiaolitao@sangfor.com.cn> --- net/smc/smc_sysctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c index d2cc2f5bf089..e06ecf0e7c84 100644 --- a/net/smc/smc_sysctl.c +++ b/net/smc/smc_sysctl.c @@ -51,5 +51,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); } -- 2.33.0