diff options
author | Krzysztof Kozlowski <krzk@kernel.org> | 2017-06-28 14:56:20 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-07-27 22:07:59 (GMT) |
commit | d2bb0af4463d0fd094385d8e15f8f18c9adaafa4 (patch) | |
tree | 7c5cfbd07d8eb8fbb7fe21bd9bd84debf00f63a6 /drivers/base | |
parent | 178aa241fc070e5b34c5bbe3f9ae0a6b0b335840 (diff) | |
download | linux-d2bb0af4463d0fd094385d8e15f8f18c9adaafa4.tar.xz |
PM / Domains: Fix unsafe iteration over modified list of domains
commit a7e2d1bce4c1db471f1cbc0c4666a3112bbf0994 upstream.
of_genpd_remove_last() iterates over list of domains and removes
matching element thus it has to use safe version of list iteration.
Fixes: 17926551c98a (PM / Domains: Add support for removing nested PM domains by provider)
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-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 4554654..951c214 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1752,14 +1752,14 @@ EXPORT_SYMBOL_GPL(of_genpd_add_subdomain); */ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) { - struct generic_pm_domain *gpd, *genpd = ERR_PTR(-ENOENT); + struct generic_pm_domain *gpd, *tmp, *genpd = ERR_PTR(-ENOENT); int ret; if (IS_ERR_OR_NULL(np)) return ERR_PTR(-EINVAL); mutex_lock(&gpd_list_lock); - list_for_each_entry(gpd, &gpd_list, gpd_list_node) { + list_for_each_entry_safe(gpd, tmp, &gpd_list, gpd_list_node) { if (gpd->provider == &np->fwnode) { ret = genpd_remove(gpd); genpd = ret ? ERR_PTR(ret) : gpd; |