public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add()
@ 2013-05-23 12:44 Hanjun Guo
  2013-05-28 23:30 ` Rafael J. Wysocki
  0 siblings, 1 reply; 9+ messages in thread
From: Hanjun Guo @ 2013-05-23 12:44 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-kernel, patches, linaro-kernel

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-05-31 12:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-23 12:44 [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() Hanjun Guo
2013-05-28 23:30 ` Rafael J. Wysocki
2013-05-29  1:38   ` Hanjun Guo
2013-05-29 11:07     ` Martin Mokrejs
2013-05-30  2:29       ` Hanjun Guo
2013-05-30 13:57         ` Rafael J. Wysocki
2013-05-30 22:25           ` Greg Kroah-Hartman
2013-05-31  3:58             ` Hanjun Guo
2013-05-31 12:08               ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox