[PATCH v2 1/2] eeepc-laptop: Fix user after free

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Matthew Garrett
Date: Wednesday, August 6, 2008 - 2:23 am

eeepc-laptop uses the hwmon struct after unregistering the device, 
causing an oops on module unload. Flip the ordering to fix.
                                                                                                                                                                                                        
Signed-off-by: Matthew Garrett <mjg@redhat.com>

---

commit 95f4bc41ef256b8e3dfa94cabe1faf0776ac988c
Author: Matthew Garrett <mjg59@srcf.ucam.org>
Date:   Mon Aug 4 17:57:40 2008 +0100

    Fix use after free

diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
index 9e8d79e..facdb98 100644
--- a/drivers/misc/eeepc-laptop.c
+++ b/drivers/misc/eeepc-laptop.c
@@ -553,9 +553,9 @@ static void eeepc_hwmon_exit(void)
 	hwmon = eeepc_hwmon_device;
 	if (!hwmon)
 		return ;
-	hwmon_device_unregister(hwmon);
 	sysfs_remove_group(&hwmon->kobj,
 			   &hwmon_attribute_group);
+	hwmon_device_unregister(hwmon);
 	eeepc_hwmon_device = NULL;
 }
 

-- 
Matthew Garrett | mjg59@srcf.ucam.org
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/2] eeepc-laptop: Fix user after free, Matthew Garrett, (Mon Aug 4, 10:08 am)
[PATCH 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Mon Aug 4, 10:15 am)
Re: [PATCH 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Mon Aug 4, 10:36 am)
Re: [PATCH 2/2] eeepc-laptop: Use standard interfaces, Ivo van Doorn, (Mon Aug 4, 10:53 am)
Re: [PATCH 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Mon Aug 4, 2:21 pm)
Re: [PATCH 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Mon Aug 4, 2:29 pm)
[PATCH v2 1/2] eeepc-laptop: Fix user after free, Matthew Garrett, (Wed Aug 6, 2:23 am)
[PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Wed Aug 6, 2:25 am)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Andrew Morton, (Tue Aug 19, 2:58 am)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Tue Aug 19, 4:13 am)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Tue Aug 19, 4:09 pm)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Tue Aug 19, 4:24 pm)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Tue Aug 19, 6:18 pm)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Tue Aug 19, 6:28 pm)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Tue Aug 19, 6:32 pm)
Awkward rfkill corner cases, Matthew Garrett, (Tue Aug 19, 6:42 pm)
Re: Awkward rfkill corner cases, Henrique de Moraes H ..., (Tue Aug 19, 7:30 pm)