mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
PM: domains: fix memory leak with using debugfs_lookup()
[ Upstream commit 0b6200e1e9
]
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>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
dc39fbd865
commit
dddc132eb0
@ -217,13 +217,10 @@ static void genpd_debug_add(struct generic_pm_domain *genpd);
|
|||||||
|
|
||||||
static void genpd_debug_remove(struct generic_pm_domain *genpd)
|
static void genpd_debug_remove(struct generic_pm_domain *genpd)
|
||||||
{
|
{
|
||||||
struct dentry *d;
|
|
||||||
|
|
||||||
if (!genpd_debugfs_dir)
|
if (!genpd_debugfs_dir)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d = debugfs_lookup(genpd->name, genpd_debugfs_dir);
|
debugfs_lookup_and_remove(genpd->name, genpd_debugfs_dir);
|
||||||
debugfs_remove(d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void genpd_update_accounting(struct generic_pm_domain *genpd)
|
static void genpd_update_accounting(struct generic_pm_domain *genpd)
|
||||||
|
Loading…
Reference in New Issue
Block a user