* [PATCH 1/2] PM / Domains: Fix removal of a subdomain
@ 2016-03-04 10:55 Jon Hunter
[not found] ` <1457088915-17284-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2016-03-04 10:55 UTC (permalink / raw)
To: Rafael J. Wysocki, Kevin Hilman, Ulf Hansson
Cc: Thierry Reding, linux-pm, linux-tegra, Jon Hunter
Commit 30e7a65b3fdb ("PM / Domains: Ensure subdomain is not in use
before removing") added a test to ensure that a subdomain is not a
master to another subdomain or if any devices are using the subdomain
before removing. This change incorrectly used the "slave_links" list to
determine if the subdomain is a master to another subdomain, where it
should have been using the "master_links" list instead. The
"slave_links" list will never be empty for a subdomain and so a
subdomain can never be removed. Fix this by testing if the
"master_links" list is empty instead.
Fixes: 30e7a65b3fdb ("PM / Domains: Ensure subdomain is not in use before removing")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Kevin Hilman <khilman@baylibre.com>
---
This first was originally included in the series to add PM domain support [0].
I am separating this for now, as it can be merged independently.
[0] http://marc.info/?l=linux-pm&m=145650174525180&w=2
drivers/base/power/domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index e8ca290dbf9d..ea9f2aa3fc33 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1382,7 +1382,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
mutex_lock(&subdomain->lock);
mutex_lock_nested(&genpd->lock, SINGLE_DEPTH_NESTING);
- if (!list_empty(&subdomain->slave_links) || subdomain->device_count) {
+ if (!list_empty(&subdomain->master_links) || subdomain->device_count) {
pr_warn("%s: unable to remove subdomain %s\n", genpd->name,
subdomain->name);
ret = -EBUSY;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] PM / Domains: Fix potential NULL pointer dereference
[not found] ` <1457088915-17284-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-03-04 10:55 ` Jon Hunter
[not found] ` <1457088915-17284-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2016-03-04 10:55 UTC (permalink / raw)
To: Rafael J. Wysocki, Kevin Hilman, Ulf Hansson
Cc: Thierry Reding, linux-pm-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter
In the function of_genpd_get_from_provider(), we never check to see if
the argument 'genpdspec' is NULL before dereferencing it. Add error
checking to handle any NULL pointers.
Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/base/power/domain.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index ea9f2aa3fc33..5bdb42bf40f4 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1686,6 +1686,9 @@ struct generic_pm_domain *of_genpd_get_from_provider(
struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
struct of_genpd_provider *provider;
+ if (!genpdspec)
+ return ERR_PTR(-EINVAL);
+
mutex_lock(&of_genpd_mutex);
/* Check if we have such a provider in our array */
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] PM / Domains: Fix potential NULL pointer dereference
[not found] ` <1457088915-17284-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-03-04 11:07 ` Ulf Hansson
[not found] ` <CAPDyKFpha7TQbvZ2B9aDuoRuOFEHzD5ZwOCADvs6=0pwCNSgQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2016-03-04 11:07 UTC (permalink / raw)
To: Jon Hunter
Cc: Rafael J. Wysocki, Kevin Hilman, Thierry Reding,
linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On 4 March 2016 at 11:55, Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
> In the function of_genpd_get_from_provider(), we never check to see if
> the argument 'genpdspec' is NULL before dereferencing it. Add error
> checking to handle any NULL pointers.
>
> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Kind regards
Uffe
> ---
> drivers/base/power/domain.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index ea9f2aa3fc33..5bdb42bf40f4 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1686,6 +1686,9 @@ struct generic_pm_domain *of_genpd_get_from_provider(
> struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
> struct of_genpd_provider *provider;
>
> + if (!genpdspec)
> + return ERR_PTR(-EINVAL);
> +
> mutex_lock(&of_genpd_mutex);
>
> /* Check if we have such a provider in our array */
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] PM / Domains: Fix potential NULL pointer dereference
[not found] ` <CAPDyKFpha7TQbvZ2B9aDuoRuOFEHzD5ZwOCADvs6=0pwCNSgQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-03-10 23:24 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-03-10 23:24 UTC (permalink / raw)
To: Ulf Hansson, Jon Hunter
Cc: Kevin Hilman, Thierry Reding,
linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Friday, March 04, 2016 12:07:23 PM Ulf Hansson wrote:
> On 4 March 2016 at 11:55, Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
> > In the function of_genpd_get_from_provider(), we never check to see if
> > the argument 'genpdspec' is NULL before dereferencing it. Add error
> > checking to handle any NULL pointers.
> >
> > Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> Acked-by: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Both this one and the [1/2] applied, thanks!
Rafael
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-10 23:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-04 10:55 [PATCH 1/2] PM / Domains: Fix removal of a subdomain Jon Hunter
[not found] ` <1457088915-17284-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-03-04 10:55 ` [PATCH 2/2] PM / Domains: Fix potential NULL pointer dereference Jon Hunter
[not found] ` <1457088915-17284-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-03-04 11:07 ` Ulf Hansson
[not found] ` <CAPDyKFpha7TQbvZ2B9aDuoRuOFEHzD5ZwOCADvs6=0pwCNSgQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-10 23:24 ` Rafael J. Wysocki
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).