Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3116504rwb; Sun, 25 Sep 2022 00:08:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4++fDRc0nPnRXUlx7Ph5l+HegimfrPYY4eBLAbsfu+xbgTS92jwyVsiIR5rcYaK1hHJ4wp X-Received: by 2002:a05:6a02:282:b0:439:7a97:ccd with SMTP id bk2-20020a056a02028200b004397a970ccdmr15000478pgb.297.1664089708785; Sun, 25 Sep 2022 00:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664089708; cv=none; d=google.com; s=arc-20160816; b=T1bqfLxuu0NpV0T3wimYS1+jesvMEaVx0+RWK3uTdjmYMee/3L9Mz0R88RICzat4+j CNHzH9/0Yp3AKPOvxiZmks2qR0X6pxurm/iscGIEcqKjtnsv8/VzAgAPwWycbsSHWmSk tthFCm8hxhZd098gd26+E9m33X6zPNWTrbHPP9iXAtZCk5Y8Fo8CZ7Xx9LviAhNkJsUD XlE4ZDXTKavI8KbBn0/h2jy6d5codY0RW3fjmpJb/QpP+d581fWI11idbOeGT01hLdPb jw4ucYpLoYUq8bcTfxX/9S8ey30D3HINNE94U9nskr5GKWwnFHqF9FZfsADhWY2Jv2NZ FpdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0UHncLBE2u8i6c0juIjafxqKnrIA8ZAVsYTNuqpN3hE=; b=PLbfLYZgwcObV4h+IO7ZDgXE7nrMdsXomlP1UKx06RszNc9gRBet3AS2M/KP0ZiAZ+ sQpfma/LS8208wMDdeHPnbHABsvgolJnB8m0qQQkoK/u4eA4Y+yAvT+5bVilYF7iI+43 +RXibq2b2PbaBpsXyoPEnpbByNEKXifePiDtNwfuKGzHWxA81tIsUA7CFkP6WZd2AyXT NV85S88kuqKyP/INRxmdRlnjzrVJOcyI5X8i9vXdo9bNOqAFID/ZNRzUp84BWGgnWRA1 M7MdwJKGdu57ofRjg+cZxDmuz6YI7joNwweCuz8MENVH082uclta+VL3FBg5NZeh0ssT TZZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="vrc1l/Bb"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m11-20020a170902f64b00b00178a944c068si7276588plg.478.2022.09.25.00.08.16; Sun, 25 Sep 2022 00:08:28 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="vrc1l/Bb"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbiIYG6l (ORCPT + 99 others); Sun, 25 Sep 2022 02:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbiIYG6j (ORCPT ); Sun, 25 Sep 2022 02:58:39 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EB722D74D; Sat, 24 Sep 2022 23:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0UHncLBE2u8i6c0juIjafxqKnrIA8ZAVsYTNuqpN3hE=; b=vrc1l/BbA2MkODh06AF28r+Wrq ijXTir8340i9KJSZJW/e5tf3eNMU0L5hx0KXWDvqxVVPTqACPt1JztD9mpObzH25LJa7lAZRNwMAn jRXrp6mksci6Kln2fwe5hjTVxLpkBVtDmfkQYS5Kqigrr1paoNSswB4tPq1mxdsgImARNCFQTkQ9/ VssLG2YWSYLVB+0e+umeym67yduR0Y9NzJOLFrW8yKX0h7fJjtNslOGYobHK/9fP8pW3KUxFBipZN +D/WtOdNBykHkVxtTMM2hkagZTxAk8PTRs1fkmsALrdiyLTvFKG8NSK89Uxm0fP5Aa5hAmmHqKQNn wzjC4VBw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34478) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ocLax-0007nE-JX; Sun, 25 Sep 2022 07:58:31 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1ocLav-0003yb-E4; Sun, 25 Sep 2022 07:58:29 +0100 Date: Sun, 25 Sep 2022 07:58:29 +0100 From: "Russell King (Oracle)" To: Marcin Wojtas Cc: Greg Kroah-Hartman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , stable Subject: Re: [PATCH net] net: mvpp2: debugfs: fix problem with previous memory leak fix Message-ID: References: <20220921114444.2247083-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 On Sun, Sep 25, 2022 at 01:27:06AM +0200, Marcin Wojtas wrote: > Hi Russell, > > czw., 22 wrz 2022 o 19:08 Marcin Wojtas napisał(a): > > > > Hi, > > > > Thank you both for the patches. > > > > > > czw., 22 wrz 2022 o 18:05 Russell King (Oracle) > > napisał(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 using > > > > debugfs_lookup()"), if the module is unloaded, the directory will still > > > > be present if the module is loaded again and creating the directory will > > > > fail, causing the creation of additional child debugfs entries for the > > > > individual devices to fail. > > > > > > > > As this module never cleaned up the root directory it created, even when > > > > loaded, and unloading/loading a module is not a normal operation, none > > > > of would normally happen. > > > > > > > > To clean all of this up, use a tiny reference counted structure to hold > > > > 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/0abb75115ffb2772f595bb3346573e27e650018b I don't see what the compile fixes were in that - it looks like my patch ported onto current -net. Obvious changes: - moved mvpp2_dbgfs_exit() declaration from after mvpp2_dbgfs_cleanup() to before. - moved definition of mvpp2_root to the top of the file (as no effect on the code.) and the change to port it: - dropped my mvpp2_dbgfs_init() hunk (because it's different in -net) - removed static declaration of mvpp2_root in mvpp2_dbgfs_init() I'm not seeing any other changes. Note that Sasha has submitted a revert of Greg's original patch for mainline, so my original patch should apply as-is if that revert happens - and I don't see any compile issues with it. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!