summaryrefslogtreecommitdiff
path: root/drivers/base/power
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-03-04 13:55:15 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-03-09 02:41:07 +0300
commit41795a8a3cff8e4ba54236ca16c3814ba9cd7f39 (patch)
treeba2adcb9e606cee93dbac2febc562805702e0fcd /drivers/base/power
parentbeda5fc1ff9b527059290a97b672d2ee0eb7b92f (diff)
downloadlinux-41795a8a3cff8e4ba54236ca16c3814ba9cd7f39.tar.xz
PM / Domains: Fix potential NULL pointer dereference
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@nvidia.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/domain.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 79f5d3965931..56705b52758e 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1702,6 +1702,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 */