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>
This commit is contained in:
Hanjun Guo 2013-05-31 11:36:08 +08:00 коммит произвёл Rafael J. Wysocki
Родитель 242831eb15
Коммит 173a5a4c90
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -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;