diff options
author | Krzysztof Kozlowski <krzk@kernel.org> | 2017-06-28 10:56:18 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-06-28 19:24:35 -0400 |
commit | c6e83cac3eda5f7dd32ee1453df2f7abb5c6cd46 (patch) | |
tree | e218f86ee3210882c0a6f81423af062532ae5c3f | |
parent | 8b55e55ee44356d68f4a7ee4b11f9cbb1f5958cc (diff) |
PM / Domains: Fix unsafe iteration over modified list of device links
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)")
Cc: 3.1+ <stable@vger.kernel.org> # 3.1+
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>
-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 b8d7907ee101..048dc74e3d72 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -1446,7 +1446,7 @@ EXPORT_SYMBOL_GPL(pm_genpd_add_subdomain); | |||
1446 | int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, | 1446 | int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, |
1447 | struct generic_pm_domain *subdomain) | 1447 | struct generic_pm_domain *subdomain) |
1448 | { | 1448 | { |
1449 | struct gpd_link *link; | 1449 | struct gpd_link *l, *link; |
1450 | int ret = -EINVAL; | 1450 | int ret = -EINVAL; |
1451 | 1451 | ||
1452 | if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain)) | 1452 | if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain)) |
@@ -1462,7 +1462,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, | |||
1462 | goto out; | 1462 | goto out; |
1463 | } | 1463 | } |
1464 | 1464 | ||
1465 | list_for_each_entry(link, &genpd->master_links, master_node) { | 1465 | list_for_each_entry_safe(link, l, &genpd->master_links, master_node) { |
1466 | if (link->slave != subdomain) | 1466 | if (link->slave != subdomain) |
1467 | continue; | 1467 | continue; |
1468 | 1468 | ||