diff options
author | Hanjun Guo <hanjun.guo@linaro.org> | 2013-05-30 23:36:08 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-01 16:23:39 -0400 |
commit | 173a5a4c909789fcd57d00355d2237618a3824a4 (patch) | |
tree | 612b1a86e74a833e9412f992cbc4f75b641478bc /drivers | |
parent | 242831eb15a06fa4414eaa705fdc6dd432ab98d1 (diff) |
ACPI / processor: Fix potential NULL pointer dereference in acpi_processor_add()
In acpi_processor_add(), get_cpu_device() may return NULL in some cases
which is then passed to acpi_bind_one() and that will case a NULL
pointer dereference to occur.
Add a check to prevent that from happening.
[rjw: Changelog]
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/acpi_processor.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 157e7389a5ff..e9b01e35ac37 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c | |||
@@ -393,6 +393,11 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device, | |||
393 | per_cpu(processors, pr->id) = pr; | 393 | per_cpu(processors, pr->id) = pr; |
394 | 394 | ||
395 | dev = get_cpu_device(pr->id); | 395 | dev = get_cpu_device(pr->id); |
396 | if (!dev) { | ||
397 | result = -ENODEV; | ||
398 | goto err; | ||
399 | } | ||
400 | |||
396 | result = acpi_bind_one(dev, pr->handle); | 401 | result = acpi_bind_one(dev, pr->handle); |
397 | if (result) | 402 | if (result) |
398 | goto err; | 403 | goto err; |