]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
eeepc-laptop: fix use after free
authorMatthew Garrett <mjg59@srcf.ucam.org>
Wed, 20 Aug 2008 22:50:16 +0000 (22:50 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 8 Sep 2008 11:44:16 +0000 (04:44 -0700)
commit f14413184b1de4dcbd5ec3e7c129c3ce2079f543 upstream

Date: Wed, 20 Aug 2008 14:08:57 -0700
Subject: 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 <mjg@redhat.com>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Karol Kozimor <sziwan@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/misc/eeepc-laptop.c

index 6d727609097fc4676e65cc381403b511197eec0b..3f3abf941f17ab768152f5e4b48ef37cc9bf9c0b 100644 (file)
@@ -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;
 }