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 5A55BC433EF for ; Fri, 22 Jul 2022 10:46:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234604AbiGVKqG (ORCPT ); Fri, 22 Jul 2022 06:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229980AbiGVKqF (ORCPT ); Fri, 22 Jul 2022 06:46:05 -0400 Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 390489D527 for ; Fri, 22 Jul 2022 03:46:04 -0700 (PDT) Received: from unknown (HELO kinkan2-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 22 Jul 2022 19:46:03 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan2-ex.css.socionext.com (Postfix) with ESMTP id 15A542059027; Fri, 22 Jul 2022 19:46:03 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Fri, 22 Jul 2022 19:46:03 +0900 Received: from [10.212.180.8] (unknown [10.212.180.8]) by kinkan2.css.socionext.com (Postfix) with ESMTP id 512D6B62A4; Fri, 22 Jul 2022 19:46:02 +0900 (JST) Subject: Re: [PATCH 1/1] drivers/net/ethernet: fix a memory leak To: Yuanjun Gong References: <20220722043327.2259-1-ruc_gongyuanjun@163.com> Cc: netdev@vger.kernel.org From: Kunihiko Hayashi Message-ID: <190b317a-8a32-f1bc-a741-5e7745da962d@socionext.com> Date: Fri, 22 Jul 2022 19:46:01 +0900 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20220722043327.2259-1-ruc_gongyuanjun@163.com> Content-Type: text/plain; charset=iso-2022-jp; format=flowed; delsp=yes Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi, On 2022/07/22 13:33, Yuanjun Gong wrote: > In ave_remove, ndev should be freed with free_netdev before return. > > Signed-off-by: Yuanjun Gong > --- > drivers/net/ethernet/socionext/sni_ave.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/socionext/sni_ave.c > b/drivers/net/ethernet/socionext/sni_ave.c > index f0c8de2c6075..9d1c1cdd04af 100644 > --- a/drivers/net/ethernet/socionext/sni_ave.c > +++ b/drivers/net/ethernet/socionext/sni_ave.c > @@ -1725,6 +1725,7 @@ static int ave_remove(struct platform_device *pdev) > unregister_netdev(ndev); > netif_napi_del(&priv->napi_rx); > netif_napi_del(&priv->napi_tx); > + free_netdev(ndev); This ave driver uses devm_allocate_etherdev() to allocate "ndev". It will be released automatically when removing the driver. Therefore, it is not necessary to release it explicitly. Please refer to the commit e87fb82ddc3b ("net: ethernet: ave: Replace alloc_etherdev() with devm_alloc_etherdev()"). Thank you, > > return 0; > } > --- Best Regards Kunihiko Hayashi