From: Krzysztof Kozlowski <krzk@kernel.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Kevin Hilman <khilman@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>, Pavel Machek <pavel@ucw.cz>,
Len Brown <len.brown@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>, stable@vger.kernel.org
Subject: [PATCH 4/8] PM / domains: Fix unsafe iteration over modified list of device links
Date: Fri, 9 Jun 2017 18:08:49 +0200 [thread overview]
Message-ID: <20170609160853.31789-5-krzk@kernel.org> (raw)
In-Reply-To: <20170609160853.31789-1-krzk@kernel.org>
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: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/base/power/domain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 0f416563479b..325962702bc8 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1405,7 +1405,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))
@@ -1421,7 +1421,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;
--
2.9.3
next prev parent reply other threads:[~2017-06-09 16:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-09 16:08 [PATCH 0/8] PM / Domains: Bunch of small improvements and fixes Krzysztof Kozlowski
2017-06-09 16:08 ` [PATCH 1/8] PM / Domains: Constify genpd pointer Krzysztof Kozlowski
2017-06-09 16:08 ` [PATCH 2/8] PM / domains: Protect reading loop over list of domains Krzysztof Kozlowski
2017-06-09 16:16 ` Krzysztof Kozlowski
2017-06-12 12:57 ` Ulf Hansson
2017-06-12 13:10 ` Krzysztof Kozlowski
2017-06-09 16:08 ` [PATCH 3/8] PM / domains: Add lockdep asserts for domains list mutex Krzysztof Kozlowski
2017-06-09 16:08 ` Krzysztof Kozlowski [this message]
2017-06-09 16:08 ` [PATCH 5/8] PM / domains: Fix unsafe iteration over modified list of domain providers Krzysztof Kozlowski
2017-06-09 16:08 ` [PATCH 6/8] PM / domains: Fix unsafe iteration over modified list of domains Krzysztof Kozlowski
2017-06-09 16:08 ` [PATCH 7/8] PM / domains: Fix missing default_power_down_ok comment Krzysztof Kozlowski
2017-06-09 16:08 ` [RFC 8/8] PM / Domains: Add asserts for PM domain locks Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170609160853.31789-5-krzk@kernel.org \
--to=krzk@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=stable@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).