Skip to contentSkip to conversation

Revert "net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()"

PATCH Applied Sasha Levin 3 participants 3 messages Sep 23, 2022 – Sep 26, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()"

This reverts commit fe2c9c61f668cde28dac2b188028c5299cedcc1e.

Quoted 8 lines · Russell King (Oracle)

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 <[email protected]>
Cc Russell King <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Fixes fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()")
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +2 -2
index 0eec05d905eb..4a3baa7e0142 100644
@@ -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);
 
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Sasha Levin

This reverts commit fe2c9c61f668cde28dac2b188028c5299cedcc1e.

Quoted 8 lines · Russell King (Oracle)

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 <[email protected]>
Cc Russell King <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Fixes fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()")
Quoted 3 lines
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#2 lore raw
In reply to Sasha Levin
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Fri, 23 Sep 2022 19:47:36 -0400 you wrote:

This reverts commit fe2c9c61f668cde28dac2b188028c5299cedcc1e.

Quoted 6 lines · Russell King (Oracle)

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?

Quoted 4 lines
Quoted 2 lines

I don't think this patch should be backported to stable trees until this point is addressed.

[...]

Here is the summary with links:
- Revert "net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()"

    https://git.kernel.org/netdev/net/c/6052a4c11fd8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html