]> err.no Git - linux-2.6/commitdiff
[PATCH] drivers/hwmon/*: kfree() correct pointers
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 25 Aug 2005 21:49:14 +0000 (01:49 +0400)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 26 Aug 2005 23:30:30 +0000 (16:30 -0700)
The adm9240 driver, in adm9240_detect(), allocates a structure.  The
error path attempts to kfree() ->client field of it (second one),
resulting in an oops (or slab corruption) if the hardware is not present.

->client field in adm1026, adm1031, smsc47b397 and smsc47m1 is the first in
${HWMON}_data structure, but fix them too.

Signed-off-by: Jonathan Corbet <corbet@lwn.net
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/hwmon/adm1026.c
drivers/hwmon/adm1031.c
drivers/hwmon/adm9240.c
drivers/hwmon/smsc47b397.c
drivers/hwmon/smsc47m1.c

index 4fa17c76eea2247dae603e5ca124cfe58775b0f1..ded6e8adc8543b7560ace693234c3217c7dfdf8b 100644 (file)
@@ -1691,7 +1691,7 @@ int adm1026_detect(struct i2c_adapter *adapter, int address,
 
        /* Error out and cleanup code */
 exitfree:
-       kfree(new_client);
+       kfree(data);
 exit:
        return err;
 }
index 9168e983ca1d53b4a946316e22da7a362ca89c8e..4211c8b4601a6d05168cbc74dc5d0ec5befc9d52 100644 (file)
@@ -834,7 +834,7 @@ static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind)
        return 0;
 
 exit_free:
-       kfree(new_client);
+       kfree(data);
 exit:
        return err;
 }
index 5c68e9c311aa232abce025caaea75e9a7d5f860c..ce2a6eb93f6e5d4c7baed6fc26797b86988559e4 100644 (file)
@@ -616,7 +616,7 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind)
 
        return 0;
 exit_free:
-       kfree(new_client);
+       kfree(data);
 exit:
        return err;
 }
index 251ac2659554d8fd77351cf54ef2ad955a7237be..fdeeb3ab6f2f3e9146b607ddc00c5d3ffd239bed 100644 (file)
@@ -298,7 +298,7 @@ static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind)
        return 0;
 
 error_free:
-       kfree(new_client);
+       kfree(data);
 error_release:
        release_region(addr, SMSC_EXTENT);
        return err;
index 897117a7213f0624a04e55deaaf46de38aaab88e..7166ad0b2fda666e5ace936c0b3960de9bbdd7b0 100644 (file)
@@ -495,7 +495,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
        return 0;
 
 error_free:
-       kfree(new_client);
+       kfree(data);
 error_release:
        release_region(address, SMSC_EXTENT);
        return err;