drivers: base: component: fix memory leak with using debugfs_lookup()
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 1/2 drivers: base: component: 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 "Rafael J. Wysocki" <[email protected]>
Signed-off-by Greg Kroah-Hartman <[email protected]>
--- drivers/base/component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/component.c +1 -1
@@ -125,7 +125,7 @@ static void component_debugfs_add(struct aggregate_device *m)static void component_debugfs_del (struct aggregate_device *m) { -debugfs_remove (debugfs_lookup (dev_name (m->parent), component_debugfs_dir)); +debugfs_lookup_and_remove (dev_name (m->parent), component_debugfs_dir); }#else
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 2/2 drivers: base: dd: 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 "Rafael J. Wysocki" <[email protected]>
Signed-off-by Greg Kroah-Hartman <[email protected]>
--- drivers/base/dd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dd.c +1 -1
@@ -370,7 +370,7 @@ late_initcall(deferred_probe_initcall); static void __exit deferred_probe_exit(void) { -debugfs_remove_recursive (debugfs_lookup ("devices_deferred" ,NULL )); +debugfs_lookup_and_remove ("devices_deferred" ,NULL ); }__exitcall (deferred_probe_exit);
Signature · 1 line
2.39.1