[PATCH 1/1] ACPI / processor: Fix potential NULL pointer dereferencein acpi_processor_add()
From: Hanjun Guo
Date: Thu May 30 2013 - 23:36:08 EST
In acpi_processor_add(), get_cpu_device() will return NULL in some cases,
and ACPI_HANDLE_SET() just use the return dev directly, this will case a
potential NULL pointer dereference, fix it.
Signed-off-by: Hanjun Guo <hanjun.guo@xxxxxxxxxx>
---
drivers/acpi/acpi_processor.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 587d2af..4466b36 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -389,6 +389,11 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device,
per_cpu(processor_device_array, pr->id) = device;
dev = get_cpu_device(pr->id);
+ if (!dev) {
+ result = -ENODEV;
+ goto err;
+ }
+
ACPI_HANDLE_SET(dev, pr->handle);
result = acpi_bind_one(dev, NULL);
if (result)
--
1.7.9.5
--------------040608000109010708060807--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/