Skip to content

Commit 5b268d8

Browse files
gregkhKAGA-KOKO
authored andcommitted
time/debug: 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. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230202151214.2306822-1-gregkh@linuxfoundation.org
1 parent 915d4ad commit 5b268d8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/time/test_udelay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ module_init(udelay_test_init);
149149
static void __exit udelay_test_exit(void)
150150
{
151151
mutex_lock(&udelay_test_lock);
152-
debugfs_remove(debugfs_lookup(DEBUGFS_FILENAME, NULL));
152+
debugfs_lookup_and_remove(DEBUGFS_FILENAME, NULL);
153153
mutex_unlock(&udelay_test_lock);
154154
}
155155

0 commit comments

Comments
 (0)