Skip to content

Commit

Permalink
PM / Domains: Fix potential NULL pointer dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jon Hunter authored and Rafael J. Wysocki committed Mar 8, 2016
1 parent beda5fc commit 41795a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 41795a8

Please sign in to comment.