From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F622C433F5 for ; Mon, 28 Mar 2022 01:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231680AbiC1CAr (ORCPT ); Sun, 27 Mar 2022 22:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbiC1CAo (ORCPT ); Sun, 27 Mar 2022 22:00:44 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E29962C6 for ; Sun, 27 Mar 2022 18:59:03 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=tonylu@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0V8KLcU9_1648432739; Received: from localhost(mailfrom:tonylu@linux.alibaba.com fp:SMTPD_---0V8KLcU9_1648432739) by smtp.aliyun-inc.com(127.0.0.1); Mon, 28 Mar 2022 09:59:00 +0800 Date: Mon, 28 Mar 2022 09:58:58 +0800 From: Tony Lu To: Eric Dumazet Cc: "David S . Miller" , Jakub Kicinski , Paolo Abeni , netdev , Eric Dumazet , syzbot , Dust Li Subject: Re: [PATCH net] net/smc: fix a memory leak in smc_sysctl_net_exit() Message-ID: Reply-To: Tony Lu References: <20220325165021.570708-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220325165021.570708-1-eric.dumazet@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Mar 25, 2022 at 09:50:21AM -0700, Eric Dumazet wrote: > From: Eric Dumazet > > 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 > Reported-by: syzbot > Cc: Tony Lu > Cc: Dust Li > --- > 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