[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YkEWYutckbyQoa62@TonyMac-Alibaba>
Date: Mon, 28 Mar 2022 09:58:58 +0800
From: Tony Lu <tonylu@...ux.alibaba.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
syzbot <syzkaller@...glegroups.com>,
Dust Li <dust.li@...ux.alibaba.com>
Subject: Re: [PATCH net] net/smc: fix a memory leak in smc_sysctl_net_exit()
On Fri, Mar 25, 2022 at 09:50:21AM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> 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@...gle.com>
> Reported-by: syzbot <syzkaller@...glegroups.com>
> Cc: Tony Lu <tonylu@...ux.alibaba.com>
> Cc: Dust Li <dust.li@...ux.alibaba.com>
> ---
> 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 bae19419e7553222d74c2ae178fd5a2b6116679b..cf3ab1334c009a1a0539b2c228c4503ae391d89b 100644
> --- a/net/smc/smc_sysctl.c
> +++ b/net/smc/smc_sysctl.c
> @@ -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
Powered by blists - more mailing lists