Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2868473rwb; Sat, 24 Sep 2022 17:27:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aaZsbZBwYuyZH5CVCuFxtm5m9DnErhLZqI5vd1mM4JAIBRpN2GQogMOhmiA+p0s0xkPxn X-Received: by 2002:a05:6402:3509:b0:452:20c7:5a95 with SMTP id b9-20020a056402350900b0045220c75a95mr15682175edd.427.1664065625680; Sat, 24 Sep 2022 17:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664065625; cv=none; d=google.com; s=arc-20160816; b=clCWj/WI6PTDzV3487O71hYIggV5UQPlCC1XDygnvzH157iv3iH4tta1N9lkzBy1sZ gDKDMFTzu2kmW1q+U0BfFJAQgw7d+TLLX/9FZjbE5WjswXqF+U/kS04ThMo9Wm7WaTlw abmNFtyHLdMOpCw9I/RTuhKBGN56ujJUOkCooJDww6Ob+YZKO+87UcUiHcW5myGt3szF EuZFvbTEnKNFp5GPkjzg2ZPB19FGEz2VWGSZtSznXJ8j7VxY53D0BZ7HfiZwYrK2m/jU roX9WA/U6VZGxYg2TmWtYCazMD/TR33bB5uByeJ0Y6CiexPzV9p61reKFyEoqSMh4NHf pfWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mZP7oDBm38gC57HZQIimdKWct3WBq+1FhFikVPx5VT4=; b=TEuCL1ztpu88Zn/LuSGQ4PU3oL2L0WVgndkCoZvFzsRqFHX8490HDFB22KqeQU24X0 IJD+DjROvfgBXslFLCweJAW0GERofoJVVEklH8mPEdN0x8hmH/kHjLcNIOAOtT/vSSu4 JcwJ2AbQswY11yChSDDpJKvxKxg1a3/zP92/bhX14FevU764sfH3nm5k8rHXAWpltFgP jrqhqwxJEp9iHqPn6pefgMJVSq8qUgez8fQ68I8HzC4niWTbT5ZvSxOyqWlEsi80lsyZ GcxTq9bgGbqmiqVKV15suuvX7C2jVzAE11FBHYCtcmMQF+INonkGUkTUGf04FgKu1B8u 1s3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b="h/Hs3let"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t4-20020a17090605c400b0074168953071si10035622ejt.866.2022.09.24.17.26.40; Sat, 24 Sep 2022 17:27:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b="h/Hs3let"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233791AbiIXX1V (ORCPT + 99 others); Sat, 24 Sep 2022 19:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbiIXX1T (ORCPT ); Sat, 24 Sep 2022 19:27:19 -0400 Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56DF1474F3 for ; Sat, 24 Sep 2022 16:27:18 -0700 (PDT) Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-127dca21a7dso4886721fac.12 for ; Sat, 24 Sep 2022 16:27:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=mZP7oDBm38gC57HZQIimdKWct3WBq+1FhFikVPx5VT4=; b=h/Hs3letZbXMALpqi9fP+jM4kdxnR5bmw6kKAtMnUfiErUqic1qOld7ihM0h0AegBe Yzh7vwKXCrDvMW+3rlOOZ4ZZFomkqh+rGUoGf55LxMv36SdMHis6shiClBDk0EhJGwtf Z1GzVjKSvWsXkfxWJr2f9WTR2/mejUv4QMmX4EA/XFodBIV6GVZm9jr0Mf0qiuQSPv94 EkrclIZXP4RMXq1elRec3yW9Pdb+YZM4AOYQbDpMp9/pAIUeZx2EnmAv9yCVq3GFtigZ O13aglrmq+Morik6L/lAAvw9YzD3Dzhm5tGEEYxH48gt5lPw7U5rOxaEPVsTBS4O5fAP 59GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=mZP7oDBm38gC57HZQIimdKWct3WBq+1FhFikVPx5VT4=; b=drm2yKIfX+oJuygf5BU3028YWP65coQnTaeNauyD+GnSMnnpQxO7jiGTBq27mN7vQ3 6dt6UCNgGjp0W8asYnqLHpXLWJHBM7w8Rs/OmudoavjftmUvwX9LIKqYn2Ly6b0EEAKj JNb0fpZuwd9sWPBAvwpVfF57sfno0+0tO6YV34980jN+f77qVKFnODb2HxUaHIdTxqxt uoqxBdEXog4bQt3AOaH/77MDM1mrJGWLRx9xxxDjqc64ugSt5yuKuv1dNPtuK8EwmTXU YkkZOsvg08H+46G5ostLzqVrDndBp33JGIaoo9ZhTlr8dW2f9Jp8S/z+5pY7sCb+DcVc LAQA== X-Gm-Message-State: ACrzQf1K9DBM6HblhsCAMZUePQy8uByTBKj7SjxcLobq1/irNqr9qUfi MDDJhRLsjK9K4+grCBIXze0S7b/ODuFoHNruOjb5Rg== X-Received: by 2002:a05:6870:9692:b0:12b:3e65:2516 with SMTP id o18-20020a056870969200b0012b3e652516mr8816441oaq.66.1664062036580; Sat, 24 Sep 2022 16:27:16 -0700 (PDT) MIME-Version: 1.0 References: <20220921114444.2247083-1-gregkh@linuxfoundation.org> In-Reply-To: From: Marcin Wojtas Date: Sun, 25 Sep 2022 01:27:06 +0200 Message-ID: Subject: Re: [PATCH net] net: mvpp2: debugfs: fix problem with previous memory leak fix To: "Russell King (Oracle)" Cc: Greg Kroah-Hartman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , stable Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Russell, czw., 22 wrz 2022 o 19:08 Marcin Wojtas napisa=C5=82(a): > > Hi, > > Thank you both for the patches. > > > czw., 22 wrz 2022 o 18:05 Russell King (Oracle) > napisa=C5=82(a): > > > > On Wed, Sep 21, 2022 at 01:44:44PM +0200, Greg Kroah-Hartman wrote: > > > In commit fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when us= ing > > > debugfs_lookup()"), if the module is unloaded, the directory will sti= ll > > > be present if the module is loaded again and creating the directory w= ill > > > fail, causing the creation of additional child debugfs entries for th= e > > > individual devices to fail. > > > > > > As this module never cleaned up the root directory it created, even w= hen > > > loaded, and unloading/loading a module is not a normal operation, non= e > > > of would normally happen. > > > > > > To clean all of this up, use a tiny reference counted structure to ho= ld > > > the root debugfs directory for the driver, and then clean it up when = the > > > last user of it is removed from the system. This should resolve the > > > previously reported problems, and the original memory leak that > > > fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using > > > debugfs_lookup()") was attempting to fix. > > > > For the record... I have a better fix for this, but I haven't been able > > to get it into a state suitable for submission yet. > > > > http://www.home.armlinux.org.uk/~rmk/misc/mvpp2-debugfs.diff > > > > Not yet against the net tree. Might have time tomorrow to do that, not > > sure at the moment. Medical stuff is getting in the way. :( > > > > I'd lean towards this version - it is a bit more compact. I'll try to > test that tomorrow or during the weekend. > I improved the patch compile and work (tested on my CN913x board). Feel free to submit (if you wish, I can do it too - please let me know your preference): https://github.com/semihalf-wojtas-marcin/Linux-Kernel/commit/0abb75115ffb2= 772f595bb3346573e27e650018b Best regards, Marcin