[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFq6W9=uZKwfM6QkDQCRMqkHkYO4pMRk0cs0yL_nbUBy2A@mail.gmail.com>
Date: Tue, 13 Jun 2017 12:38:42 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Kevin Hilman <khilman@...nel.org>,
Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"# 4.0+" <stable@...r.kernel.org>
Subject: Re: [PATCH v2 4/8] PM / Domains: Fix unsafe iteration over modified
list of device links
On 12 June 2017 at 17:17, Krzysztof Kozlowski <krzk@...nel.org> wrote:
> 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@...r.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
Acked-by: Ulf Hansson <ulf.hansson@...aro.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 9d3d3c2a5979..d1e438024e46 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1400,7 +1400,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))
> @@ -1416,7 +1416,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
>
Powered by blists - more mailing lists