]> Git Repo - J-linux.git/commitdiff
mm/slub: fix memory leak with using debugfs_lookup()
authorGreg Kroah-Hartman <[email protected]>
Thu, 2 Feb 2023 14:20:22 +0000 (15:20 +0100)
committerVlastimil Babka <[email protected]>
Mon, 6 Feb 2023 15:35:09 +0000 (16:35 +0100)
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: Christoph Lameter <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Hyeonggon Yoo <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Reviewed-by: Hyeonggon Yoo <[email protected]>
Acked-by: Roman Gushchin <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Vlastimil Babka <[email protected]>
mm/slub.c

index 13459c69095a25b6a1db8e24472654dca3b9d0d0..4880e461fcc53373ae06a979c941c36a59ce81e0 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -6449,7 +6449,7 @@ static void debugfs_slab_add(struct kmem_cache *s)
 
 void debugfs_slab_release(struct kmem_cache *s)
 {
-       debugfs_remove_recursive(debugfs_lookup(s->name, slab_debugfs_root));
+       debugfs_lookup_and_remove(s->name, slab_debugfs_root);
 }
 
 static int __init slab_debugfs_init(void)
This page took 0.04677 seconds and 4 git commands to generate.