Skip to content

Commit 55bf243

Browse files
gregkhpmladek
authored andcommitted
kernel/printk/index.c: fix memory leak with using debugfs_lookup()
When calling debugfs_lookup() the result must have dput() called on it, otherwise the memory will leak over time. To make things simpler, just call debugfs_lookup_and_remove() instead which handles all of the logic at once. Cc: Chris Down <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: John Ogness <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Reviewed-by: John Ogness <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f2e4cca commit 55bf243

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/printk/index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static void pi_create_file(struct module *mod)
145145
#ifdef CONFIG_MODULES
146146
static void pi_remove_file(struct module *mod)
147147
{
148-
debugfs_remove(debugfs_lookup(pi_get_module_name(mod), dfs_index));
148+
debugfs_lookup_and_remove(pi_get_module_name(mod), dfs_index);
149149
}
150150

151151
static int pi_module_notify(struct notifier_block *nb, unsigned long op,

0 commit comments

Comments
 (0)