Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1055757rwb; Thu, 22 Sep 2022 09:32:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5EAIAKYJ+V5ZBsVZ9pD8BpyckxC6aOQZS62he0U26qqX05uJ90F3Pbls9in9RhzsemYNdV X-Received: by 2002:a17:906:8b81:b0:77e:cd92:9d with SMTP id nr1-20020a1709068b8100b0077ecd92009dmr3566328ejc.484.1663864322362; Thu, 22 Sep 2022 09:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663864322; cv=none; d=google.com; s=arc-20160816; b=dlF0LLZM19phpNVfk8TqmV5EjugiQA6JXk5s5z+6fFn4noQWoedF+SLemKH1OUzpiy UV9h5JQ2Ntvh4/gsJ5vOPPvVsmCvvJDYznz3aKCkyLOM4hVqdli53b5jQmssto6+251c iPQZrjrwjyWF6mhRokhed7LmE9gTWG88PCb6VvaX97Qm29DeHjAD5gnrO1FkiflazcS7 y2uFizboBK7dPvdPzymaoubxGVgPTxXeqG78qLndbfosNzpV4eN8eDqMK2PLIdnv097d gIr7PjxDqIPl4OHjbVIsCVYVpaeGDWKbjjsGgU14AAqDrS+Dt5IYPyor+rMJpx3z39Av mg/A== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=pTxK7m5xFyeBH1/UifIeeV8u91XqECdD+VOzVFBx9Yw=; b=wPhY5PAX5URuj+lqdRU34+NzC0prMz0s43Jj65WDOFtJvaFjvuh7uD3anT+v67+W11 M9eMi4U6lkMtz8wZHHH/D5rGbIQ/gbw/YtwF1DAdbONUpfjbwoJtFd8CoyODLJr4F7ZC Aru4K35VIsL66fXMwl6ec7cV1tsFoQR3miXUEW5MRNMArck6Kv54VGcs9zLKdUDBmC8z wUoqNe0rJbTgOGLpq29wsMPtRkUKmE6GmEbon4cVyaXO99Poz8WQLSXnRGHK8ly9E5fk jDZ7/2du+9bTYfSnMivRFMUYpaNW87tMWuKaH61gXoiboSoPSjgVqBEQW9jenvzLT106 QROg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=GkwkPLFO; 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 nd27-20020a170907629b00b0076210372a3bsi6712287ejc.333.2022.09.22.09.31.35; Thu, 22 Sep 2022 09:32:02 -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=GkwkPLFO; 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 S231539AbiIVQFz (ORCPT + 99 others); Thu, 22 Sep 2022 12:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiIVQFw (ORCPT ); Thu, 22 Sep 2022 12:05:52 -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 52B9FD62E8; Thu, 22 Sep 2022 09:05:49 -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-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding: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=pTxK7m5xFyeBH1/UifIeeV8u91XqECdD+VOzVFBx9Yw=; b=GkwkPLFOMjRKNYnHlUFhuCIRYs A0kaM4MHMGKYx05zCoQr3hbXwEADEKmsHqB8IkgkzcWSB7AUin5U26Edy4d1kPH/2S2bmc1T56OYv p4WAOeelsgcI/4PPe5wNBScbHTAqKnOvnGlJa1fDE6SrDZeohGE0s4RO+u3AvEGZSGD2bXl7u1oHI Gur6ZJi/8DuAC9vnz6pwGMo1JlWiJ1r5aF4blTOedPzTKslsaHXAA1MA/t6KOnXYsEy1pbWxlQQxl nQa1GsgzfHZqptB/L48MVdkEmiae8AHZ0igKQM2gBXC08Ieb8+bug6++5TEIcahJtkqmoQ44gBPGZ nlScRIOg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34444) 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 1obOht-0004YD-2Y; Thu, 22 Sep 2022 17:05:45 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1obOhq-00010r-Sr; Thu, 22 Sep 2022 17:05:42 +0100 Date: Thu, 22 Sep 2022 17:05:42 +0100 From: "Russell King (Oracle)" To: Greg Kroah-Hartman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Marcin Wojtas , "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=us-ascii Content-Disposition: inline In-Reply-To: <20220921114444.2247083-1-gregkh@linuxfoundation.org> 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 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. :( -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!