public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister
@ 2011-01-20  9:26 R, Durgadoss
  2011-02-15  5:13 ` Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister R, Durgadoss
  2011-03-03  0:52 ` Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister Len Brown
  0 siblings, 2 replies; 4+ messages in thread
From: R, Durgadoss @ 2011-01-20  9:26 UTC (permalink / raw)
  To: Len Brown, Zhang, Rui; +Cc: linux-acpi@vger.kernel.org

Hi Len/Rui,

This patch fixes the following bug:
The thermal framework creates a temp*_crit interface, only when
the get_crit_temp pointer is defined. But during the _unregister_
path, without checking for the function definition, it is trying to
remove the temp*_crit interface.

There can be a situation, where a driver registers with the framework
and does not have a temp*_crit interface. When this driver attempts to
unregister, this will cause a kernel crash.

------------------------------------------------
From: Durgadoss R <durgadoss.r@intel.com>

Date: Thu, 20 Jan 2011 02:40:56 +0530
Subject: [PATCH] Thermal_Framework-Fix_crash_during_hwmon_unregister

This patch fixes the following bug:
The thermal framework creates a temp*_crit interface, only when
the get_crit_temp pointer is defined. But during the _unregister_
path, without checking for the function definition, it is trying to
remove the temp*_crit interface.

Signed-off-by: Durgadoss R <durgadoss.r@intel.com>

---
 drivers/thermal/thermal_sys.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 13c72c6..eef2e14 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -556,7 +556,8 @@ thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
 
 	tz->hwmon = NULL;
 	device_remove_file(hwmon->device, &tz->temp_input.attr);
-	device_remove_file(hwmon->device, &tz->temp_crit.attr);
+	if (tz->ops->get_crit_temp)
+		device_remove_file(hwmon->device, &tz->temp_crit.attr);
 
 	mutex_lock(&thermal_list_lock);
 	list_del(&tz->hwmon_node);
-- 
1.6.5.2


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

end of thread, other threads:[~2011-03-03  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-20  9:26 Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister R, Durgadoss
2011-02-15  5:13 ` Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister R, Durgadoss
2011-03-03  0:52 ` Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister Len Brown
2011-03-03  9:47   ` Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister R, Durgadoss

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