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 6663DC433F5 for ; Mon, 3 Oct 2022 16:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229445AbiJCQWe (ORCPT ); Mon, 3 Oct 2022 12:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiJCQWc (ORCPT ); Mon, 3 Oct 2022 12:22:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 119101DF2B for ; Mon, 3 Oct 2022 09:22:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A472661148 for ; Mon, 3 Oct 2022 16:22:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8970EC433D6; Mon, 3 Oct 2022 16:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664814150; bh=ka2xbNQQ4V4EQHeddHLZAFlcdwwBm3lkPpxZageiyZQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jWV382j3kbZD2lEFN6fBCRj+zwkncTR72BjI2L+jWG8ffBW7IBAvNY9lrvDJXZLoM cCzVn9TwqKEFuArodXO3QjLdiG4yhJ3Z4MR32AVuAMpB2LJPiCTRtt9h/Qc78pOkee W7TuET/9V1pbon6Eip4rkTuHD//ELyJDB/E6zCVM= Date: Mon, 3 Oct 2022 18:22:27 +0200 From: Greg Kroah-Hartman To: "Russell King (Oracle)" Cc: "David S. Miller" , Jakub Kicinski , Sasha Levin , Marcin Wojtas , Eric Dumazet , Paolo Abeni , Maxime Chevallier , netdev@vger.kernel.org Subject: Re: [PATCH net] net: mvpp2: fix mvpp2 debugfs leak Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Oct 03, 2022 at 05:19:27PM +0100, Russell King (Oracle) wrote: > When mvpp2 is unloaded, the driver specific debugfs directory is not > removed, which technically leads to a memory leak. However, this > directory is only created when the first device is probed, so the > hardware is present. Removing the module is only something a developer > would to when e.g. testing out changes, so the module would be > reloaded. So this memory leak is minor. > > The original attempt in commit fe2c9c61f668 ("net: mvpp2: debugfs: fix > memory leak when using debugfs_lookup()") that was labelled as a memory > leak fix was not, it fixed a refcount leak, but in doing so created a > problem when the module is reloaded - the directory already exists, but > mvpp2_root is NULL, so we lose all debugfs entries. This fix has been > reverted. > > This is the alternative fix, where we remove the offending directory > whenever the driver is unloaded. > > Fixes: 21da57a23125 ("net: mvpp2: add a debugfs interface for the Header Parser") > Signed-off-by: Russell King (Oracle) Reviewed-by: Greg Kroah-Hartman Thanks for fixing this up properly. greg k-h