Skip to content

Commit 5f51399

Browse files
committed
kernel/time/test_udelay.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. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 862f6a8 commit 5f51399

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/time/test_udelay.c

+1-1
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)