Skip to contentSkip to conversation

Patch "PM / Domains: Fix unsafe iteration over modified list of domains" has been added to the 4.12-stable tree

PATCH [email protected] 1 participant 1 message Jul 22, 2017

Subsystems (5)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

PM / Domains: Fix unsafe iteration over modified list of domains

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
pm-domains-fix-unsafe-iteration-over-modified-list-of-domains.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From a7e2d1bce4c1db471f1cbc0c4666a3112bbf0994 Mon Sep 17 00:00:00 2001

From: Krzysztof Kozlowski <[email protected]>
Date: Wed, 28 Jun 2017 16:56:20 +0200
Subject: PM / Domains: Fix unsafe iteration over modified list of domains

From: Krzysztof Kozlowski <[email protected]>

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)
---
 drivers/base/power/domain.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/power/domain.c +2 -2
@@ -1925,14 +1925,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;

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/pm-domains-fix-unsafe-iteration-over-modified-list-of-domain-providers.patch queue-4.12/pm-domains-fix-unsafe-iteration-over-modified-list-of-domains.patch queue-4.12/pm-domains-fix-unsafe-iteration-over-modified-list-of-device-links.patch