Skip to content

Commit c2e4065

Browse files
committed
sched/debug: fix dentry leak in update_sched_domain_debugfs
Kuyo reports that the pattern of using debugfs_remove(debugfs_lookup()) leaks a dentry and with a hotplug stress test, the machine eventually runs out of memory. Fix this up by using the newly created debugfs_lookup_and_remove() call instead which properly handles the dentry reference counting logic. Cc: Major Chen <[email protected]> Cc: stable <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Vincent Guittot <[email protected]> Cc: Dietmar Eggemann <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Ben Segall <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Daniel Bristot de Oliveira <[email protected]> Cc: Valentin Schneider <[email protected]> Cc: Matthias Brugger <[email protected]> Reported-by: Kuyo Chang <[email protected]> Tested-by: Kuyo Chang <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dec9b2f commit c2e4065

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/sched/debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ void update_sched_domain_debugfs(void)
416416
char buf[32];
417417

418418
snprintf(buf, sizeof(buf), "cpu%d", cpu);
419-
debugfs_remove(debugfs_lookup(buf, sd_dentry));
419+
debugfs_lookup_and_remove(buf, sd_dentry);
420420
d_cpu = debugfs_create_dir(buf, sd_dentry);
421421

422422
i = 0;

0 commit comments

Comments
 (0)