PM / Domains: Fix potential NULL pointer dereference
authorJon Hunter <jonathanh@nvidia.com>
Fri, 4 Mar 2016 10:55:15 +0000 (10:55 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 8 Mar 2016 23:41:07 +0000 (00:41 +0100)
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>
drivers/base/power/domain.c

index 79f5d3965931b9e53e59b26042107769ec35f7eb..56705b52758efea0fb8a95dab16700b4ecf7930e 100644 (file)
@@ -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 */