diff options
author | Krzysztof Kozlowski <krzk@kernel.org> | 2017-06-28 16:56:18 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-10-12 15:27:56 +0100 |
commit | 98000aa66b5efbd3fbef77e0715390182b8c7cc0 (patch) | |
tree | 5536ea8923987c9ea673c8ffd4c1b11971dbe557 /drivers | |
parent | 19e23fcc5cc6d96b745093038429d5215f5fb86c (diff) | |
download | linux-stable-98000aa66b5efbd3fbef77e0715390182b8c7cc0.tar.gz linux-stable-98000aa66b5efbd3fbef77e0715390182b8c7cc0.tar.bz2 linux-stable-98000aa66b5efbd3fbef77e0715390182b8c7cc0.zip |
PM / Domains: Fix unsafe iteration over modified list of device links
commit c6e83cac3eda5f7dd32ee1453df2f7abb5c6cd46 upstream.
pm_genpd_remove_subdomain() iterates over domain's master_links list and
removes matching element thus it has to use safe version of list
iteration.
Fixes: f721889ff65a ("PM / Domains: Support for generic I/O PM domains (v8)")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/power/domain.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index eee55c1e5fde..5f2e21e9fbb1 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1704,7 +1704,7 @@ int pm_genpd_add_subdomain_names(const char *master_name, int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, struct generic_pm_domain *subdomain) { - struct gpd_link *link; + struct gpd_link *l, *link; int ret = -EINVAL; if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain)) @@ -1713,7 +1713,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, start: genpd_acquire_lock(genpd); - list_for_each_entry(link, &genpd->master_links, master_node) { + list_for_each_entry_safe(link, l, &genpd->master_links, master_node) { if (link->slave != subdomain) continue; |