lkml.org 
[lkml]   [2013]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add()
In acpi_processor_add(), get_cpu_device() will return NULL sometimes,
although the chances are small, I think it should be fixed.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
drivers/acpi/processor_driver.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index bec717f..dd64f23 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -579,6 +579,10 @@ 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_clear_processor;
+ }
if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) {
result = -EFAULT;
goto err_clear_processor;
--
1.7.1

\
 
 \ /
  Last update: 2013-05-23 15:21    [W:0.056 / U:1.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site