linux-stable/drivers/base/power
Hsin-Yi Wang f0762b6a3a PM: domains: Ensure genpd_debugfs_dir exists before remove
[ Upstream commit 37101d3c71 ]

Both genpd_debug_add() and genpd_debug_remove() may be called
indirectly by other drivers while genpd_debugfs_dir is not yet
set. For example, drivers can call pm_genpd_init() in probe or
pm_genpd_init() in probe fail/cleanup path:

pm_genpd_init()
 --> genpd_debug_add()

pm_genpd_remove()
 --> genpd_remove()
   --> genpd_debug_remove()

At this time, genpd_debug_init() may not yet be called.

genpd_debug_add() checks that if genpd_debugfs_dir is NULL, it
will return directly. Make sure this is also checked
in pm_genpd_remove(), otherwise components under debugfs root
which has the same name as other components under pm_genpd may
be accidentally removed, since NULL represents debugfs root.

Fixes: 718072ceb2 ("PM: domains: create debugfs nodes when adding power domains")
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
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>
2022-08-17 15:14:17 +02:00
..
clock_ops.c
common.c PM: domains: Extend dev_pm_domain_detach() doc 2022-04-13 17:07:58 +02:00
domain.c PM: domains: Ensure genpd_debugfs_dir exists before remove 2022-08-17 15:14:17 +02:00
domain_governor.c PM: domains: Allocate governor data dynamically based on a genpd governor 2022-05-19 20:16:05 +02:00
generic_ops.c
main.c Merge branches 'pm-sleep', 'pm-domains' and 'pm-docs' 2022-03-18 18:29:21 +01:00
Makefile
power.h
qos-test.c
qos.c
runtime.c PM: runtime: Fix supplier device management during consumer probe 2022-07-01 21:04:15 +02:00
sysfs.c
trace.c
wakeirq.c PM: sleep: wakeup: Fix typos in comments 2022-03-01 16:17:32 +01:00
wakeup.c PM: wakeup: expose pm_wakeup_pending to modules 2022-05-19 19:40:25 +02:00
wakeup_stats.c