1
0
Fork 0
alistair23-linux/drivers/opp
Viresh Kumar 09b63105d0 opp: Prevent memory leak in dev_pm_opp_attach_genpd()
[ Upstream commit cb60e9602c ]

If dev_pm_opp_attach_genpd() is called multiple times (once for each CPU
sharing the table), then it would result in unwanted behavior like
memory leak, attaching the domain multiple times, etc.

Handle that by checking and returning earlier if the domains are already
attached. Now that dev_pm_opp_detach_genpd() can get called multiple
times as well, we need to protect that too.

Note that the virtual device pointers aren't returned in this case, as
they may become unavailable to some callers during the middle of the
operation.

Reported-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 09:58:06 +01:00
..
Kconfig pci-v5.3-changes 2019-07-15 20:44:49 -07:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
core.c opp: Prevent memory leak in dev_pm_opp_attach_genpd() 2020-10-29 09:58:06 +01:00
cpu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
debugfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
of.c opp: Increase parsed_static_opps in _of_add_opp_table_v1() 2020-10-01 13:18:11 +02:00
opp.h opp: Replace list_kref with a local counter 2020-10-01 13:17:26 +02:00
ti-opp-supply.c opp: ti-opp-supply: Fix platform_no_drv_owner.cocci warnings 2018-11-22 11:46:02 +05:30