summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-02 15:16:20 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-11 13:57:38 +0100
commit09709a49283f79184c998d6dafcc01590e4d654d (patch)
tree8b45bd243070be8897f38d4d841dcc470116d4c1
parentb94b39bf3d545671f210a2257d18e33c8b874699 (diff)
downloadlinux-09709a49283f79184c998d6dafcc01590e4d654d.tar.gz
linux-09709a49283f79184c998d6dafcc01590e4d654d.tar.bz2
linux-09709a49283f79184c998d6dafcc01590e4d654d.zip
drivers: base: component: fix memory leak with using debugfs_lookup()
[ Upstream commit 8deb87b1e810dd558371e88ffd44339fbef27870 ] 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" <rafael@kernel.org> Link: https://lore.kernel.org/r/20230202141621.2296458-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/base/component.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/component.c b/drivers/base/component.c
index 870485cbbb87..058f1a2cb2a9 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -130,7 +130,7 @@ static void component_master_debugfs_add(struct master *m)
static void component_master_debugfs_del(struct master *m)
{
- debugfs_remove(debugfs_lookup(dev_name(m->parent), component_debugfs_dir));
+ debugfs_lookup_and_remove(dev_name(m->parent), component_debugfs_dir);
}
#else