Skip to content

Commit

Permalink
ACPI / processor: Fix potential NULL pointer dereference in acpi_proc…
Browse files Browse the repository at this point in the history
…essor_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>
  • Loading branch information
Hanjun Guo authored and Rafael J. Wysocki committed Jun 1, 2013
1 parent 242831e commit 173a5a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/acpi/acpi_processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,11 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device,
per_cpu(processors, pr->id) = pr;

dev = get_cpu_device(pr->id);
if (!dev) {
result = -ENODEV;
goto err;
}

result = acpi_bind_one(dev, pr->handle);
if (result)
goto err;
Expand Down

0 comments on commit 173a5a4

Please sign in to comment.