* 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
* Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister
2011-01-20 9:26 Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister R, Durgadoss
@ 2011-02-15 5:13 ` R, Durgadoss
2011-03-03 0:52 ` Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister Len Brown
1 sibling, 0 replies; 4+ messages in thread
From: R, Durgadoss @ 2011-02-15 5:13 UTC (permalink / raw)
To: Len Brown, Zhang, Rui; +Cc: linux-acpi@vger.kernel.org
Hi Len/Rui,
Ping..Any comments/thoughts on this patch..?
> -----Original Message-----
> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> owner@vger.kernel.org] On Behalf Of R, Durgadoss
> Sent: Thursday, January 20, 2011 2:56 PM
> To: Len Brown; Zhang, Rui
> Cc: linux-acpi@vger.kernel.org
> Subject: Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister
>
> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister
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 ` Len Brown
2011-03-03 9:47 ` Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister R, Durgadoss
1 sibling, 1 reply; 4+ messages in thread
From: Len Brown @ 2011-03-03 0:52 UTC (permalink / raw)
To: R, Durgadoss; +Cc: Zhang, Rui, linux-acpi@vger.kernel.org
i think you may have some problems at
unregister_hwmon_device:
because we unconditionally device_remove_file() there,
even as the associated device_create_files failed.
please send just 1 copy of a patchin email,
and remember, as funky as it sounds, the comments
that are to be excluded from the check-in comment
go below the first '---'
thanks,
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister
2011-03-03 0:52 ` Patch[1/1]:ThermalFramework:Fix_crash_during_hwmon_unregister Len Brown
@ 2011-03-03 9:47 ` R, Durgadoss
0 siblings, 0 replies; 4+ messages in thread
From: R, Durgadoss @ 2011-03-03 9:47 UTC (permalink / raw)
To: Len Brown; +Cc: Zhang, Rui, linux-acpi@vger.kernel.org
Hi Len,
> i think you may have some problems at
> unregister_hwmon_device:
>
> because we unconditionally device_remove_file() there,
> even as the associated device_create_files failed.
Thanks for pointing it out. I missed it.
Shall send an appropriate patch.
>
> please send just 1 copy of a patchin email,
> and remember, as funky as it sounds, the comments
> that are to be excluded from the check-in comment
> go below the first '---'
Shall take care of it from now on.
Thanks,
Durga
^ permalink raw reply [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