Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1662602
| From | Krzysztof Kozlowski <krzk@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/8] PM / domains: Protect reading loop over list of domains |
| Date | 2017-06-09 18:20 +0200 |
| Message-ID | <tQuNJ-3M7-27@gated-at.bofh.it> (permalink) |
| References | <tQuE1-3IK-9@gated-at.bofh.it> <tQuE2-3IK-33@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Jun 09, 2017 at 06:08:47PM +0200, Krzysztof Kozlowski wrote:
> The pm_genpd_present() iterates over list of domains so grabbing a
> gpd_list_lock mutex is necessary before calling it. Otherwise we could
> end up in iterating over and modifying the list at the same time.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
> drivers/base/power/domain.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 2e8d0f423507..2a6935dc0164 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1099,8 +1099,13 @@ static void genpd_syscore_switch(struct device *dev, bool suspend)
> struct generic_pm_domain *genpd;
>
> genpd = dev_to_genpd(dev);
> - if (!pm_genpd_present(genpd))
> +
> + mutex_lock(&gpd_list_lock);
> + if (!pm_genpd_present(genpd)) {
> + mutex_unlock(&gpd_list_lock);
> return;
> + }
> + mutex_unlock(&gpd_list_lock);
Eh, I might be too fast as this is not executed on my platform. The
genpd_syscore_switch() seems to be called by clocksource_suspend() which
is called by syscore ops. Should be safe but actually not tested.
Someone with SH hardware is needed...
Best regards,
Krzysztof
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/8] PM / Domains: Bunch of small improvements and fixes Krzysztof Kozlowski <krzk@kernel.org> - 2017-06-09 18:10 +0200
[PATCH 1/8] PM / Domains: Constify genpd pointer Krzysztof Kozlowski <krzk@kernel.org> - 2017-06-09 18:10 +0200
[PATCH 2/8] PM / domains: Protect reading loop over list of domains Krzysztof Kozlowski <krzk@kernel.org> - 2017-06-09 18:10 +0200
Re: [PATCH 2/8] PM / domains: Protect reading loop over list of domains Krzysztof Kozlowski <krzk@kernel.org> - 2017-06-09 18:20 +0200
Re: [PATCH 2/8] PM / domains: Protect reading loop over list of domains Ulf Hansson <ulf.hansson@linaro.org> - 2017-06-12 15:00 +0200
Re: [PATCH 2/8] PM / domains: Protect reading loop over list of domains Krzysztof Kozlowski <krzk@kernel.org> - 2017-06-12 15:20 +0200
[PATCH 5/8] PM / domains: Fix unsafe iteration over modified list of domain providers Krzysztof Kozlowski <krzk@kernel.org> - 2017-06-09 18:10 +0200
[PATCH 3/8] PM / domains: Add lockdep asserts for domains list mutex Krzysztof Kozlowski <krzk@kernel.org> - 2017-06-09 18:20 +0200
[PATCH 4/8] PM / domains: Fix unsafe iteration over modified list of device links Krzysztof Kozlowski <krzk@kernel.org> - 2017-06-09 18:20 +0200
[PATCH 7/8] PM / domains: Fix missing default_power_down_ok comment Krzysztof Kozlowski <krzk@kernel.org> - 2017-06-09 18:20 +0200
csiph-web