Skip to content

Commit

Permalink
PM / Domains: Fix unsafe iteration over modified list of device links
Browse files Browse the repository at this point in the history
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: f721889 ("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>
  • Loading branch information
Krzysztof Kozlowski authored and Rafael J. Wysocki committed Jun 28, 2017
1 parent 8b55e55 commit c6e83ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ EXPORT_SYMBOL_GPL(pm_genpd_add_subdomain);
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))
Expand All @@ -1462,7 +1462,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
goto out;
}

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;

Expand Down

0 comments on commit c6e83ca

Please sign in to comment.