From: Matthew Garrett Date: Wed, 20 Aug 2008 21:08:57 +0000 (-0700) Subject: eeepc-laptop: fix use after free X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f14413184b1de4dcbd5ec3e7c129c3ce2079f543;p=linux-beck.git eeepc-laptop: fix use after free 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 Cc: Henrique de Moraes Holschuh Cc: Corentin Chary Cc: Karol Kozimor Cc: [2.6.26.x] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c index 9e8d79e7e9f4..facdb9893c84 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; }