From ad0f409051a67dde8d454990e09b6db41f675876 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Sun, 4 Jan 2015 16:35:59 +0800 Subject: [PATCH] int340x_thermal/processor_thermal_device: return failure when there is no ACPI device object processor_thermal_device driver needs ACPI support to work. Thus, the driver probing should fail when there is no ACPI device object asscociated. This fixes a NULL pointer dereference when the driver is loaded with INT340X feature disabled in BIOS. Reported-by: Chen Yu Signed-off-by: Zhang Rui Tested-by: Chen Yu --- drivers/thermal/int340x_thermal/processor_thermal_device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/thermal/int340x_thermal/processor_thermal_device.c b/drivers/thermal/int340x_thermal/processor_thermal_device.c index 31bb553aac26..0fe5dbbea968 100644 --- a/drivers/thermal/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/int340x_thermal/processor_thermal_device.c @@ -130,6 +130,8 @@ static int proc_thermal_add(struct device *dev, int ret; adev = ACPI_COMPANION(dev); + if (!adev) + return -ENODEV; status = acpi_evaluate_object(adev->handle, "PPCC", NULL, &buf); if (ACPI_FAILURE(status)) -- 2.20.1