From patchwork Fri Sep 23 23:47:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 12987273 X-Patchwork-Delegate: kuba@kernel.org 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 3280DC04A95 for ; Fri, 23 Sep 2022 23:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231601AbiIWXrt (ORCPT ); Fri, 23 Sep 2022 19:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbiIWXrr (ORCPT ); Fri, 23 Sep 2022 19:47:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7F79124746 for ; Fri, 23 Sep 2022 16:47:46 -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 ams.source.kernel.org (Postfix) with ESMTPS id 6D20CB80B9B for ; Fri, 23 Sep 2022 23:47:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A222C433C1; Fri, 23 Sep 2022 23:47:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663976864; bh=TJQkrbWdnc+22PlObL9lKONmsxS044CUiTNKPnuvEgw=; h=From:To:Cc:Subject:Date:From; b=YUNh2ZaIsl7W45tQ9lRKU1mI+GIFbvbWX9fT1ylaUFVQBJVLVw4m0LpjmDERhk2yB wV7oGv99czEIBOnWzC9NYKgUNfovCMlJ/0in8PcS9aPQLTGM2CJLkDtT5cWGT6zVWE p31ucL2S9oXTepTeuDJ/5DrTUV2BhkzFO31Wpo0qxZecNLIALFxWNVHaMEaHi+PtY9 /mAVRiCjALqNO+BVrQbQnyP23+nNj0tij12xZId6I1ANMX13SFgIVpenbA8M26Mc1N UCsefbMFLJfWX8Lm0/uX+VLJXzjhjup8pu/Wf7alBHW2YKGXIikkpubxS/OSvckRTZ JUPeHMP8vYElg== From: Sasha Levin Cc: Sasha Levin , Marcin Wojtas , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Greg Kroah-Hartman , netdev@vger.kernel.org, stable@kernel.org Subject: [PATCH] Revert "net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()" Date: Fri, 23 Sep 2022 19:47:36 -0400 Message-Id: <20220923234736.657413-1-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This reverts commit fe2c9c61f668cde28dac2b188028c5299cedcc1e. On Tue, Sep 13, 2022 at 05:48:58PM +0100, Russell King (Oracle) wrote: >What happens if this is built as a module, and the module is loaded, >binds (and creates the directory), then is removed, and then re- >inserted? Nothing removes the old directory, so doesn't >debugfs_create_dir() fail, resulting in subsequent failure to add >any subsequent debugfs entries? > >I don't think this patch should be backported to stable trees until >this point is addressed. Revert until a proper fix is available as the original behavior was better. Cc: Marcin Wojtas Cc: Russell King Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Greg Kroah-Hartman Cc: netdev@vger.kernel.org Cc: stable@kernel.org Reported-by: Russell King Fixes: fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()") Signed-off-by: Sasha Levin Reviewed-by: Greg Kroah-Hartman --- drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c index 0eec05d905eb..4a3baa7e0142 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c @@ -700,10 +700,10 @@ void mvpp2_dbgfs_cleanup(struct mvpp2 *priv) void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name) { - static struct dentry *mvpp2_root; - struct dentry *mvpp2_dir; + struct dentry *mvpp2_dir, *mvpp2_root; int ret, i; + mvpp2_root = debugfs_lookup(MVPP2_DRIVER_NAME, NULL); if (!mvpp2_root) mvpp2_root = debugfs_create_dir(MVPP2_DRIVER_NAME, NULL);