aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2005-08-25 17:49:14 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-26 19:30:30 -0400
commit1f57ff89fee47a317e9e8ca63bf0f139802cc116 (patch)
tree0db3419ab73cabed542a18cd5c7da50b03df896c /drivers/hwmon
parentd634cc15e8f33332038dc9c078beae79f9382ada (diff)
[PATCH] drivers/hwmon/*: kfree() correct pointers
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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/adm1026.c2
-rw-r--r--drivers/hwmon/adm1031.c2
-rw-r--r--drivers/hwmon/adm9240.c2
-rw-r--r--drivers/hwmon/smsc47b397.c2
-rw-r--r--drivers/hwmon/smsc47m1.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 4fa17c76eea2..ded6e8adc854 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -1691,7 +1691,7 @@ int adm1026_detect(struct i2c_adapter *adapter, int address,
1691 1691
1692 /* Error out and cleanup code */ 1692 /* Error out and cleanup code */
1693exitfree: 1693exitfree:
1694 kfree(new_client); 1694 kfree(data);
1695exit: 1695exit:
1696 return err; 1696 return err;
1697} 1697}
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 9168e983ca1d..4211c8b4601a 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -834,7 +834,7 @@ static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind)
834 return 0; 834 return 0;
835 835
836exit_free: 836exit_free:
837 kfree(new_client); 837 kfree(data);
838exit: 838exit:
839 return err; 839 return err;
840} 840}
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
index 5c68e9c311aa..ce2a6eb93f6e 100644
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -616,7 +616,7 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind)
616 616
617 return 0; 617 return 0;
618exit_free: 618exit_free:
619 kfree(new_client); 619 kfree(data);
620exit: 620exit:
621 return err; 621 return err;
622} 622}
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c
index 251ac2659554..fdeeb3ab6f2f 100644
--- a/drivers/hwmon/smsc47b397.c
+++ b/drivers/hwmon/smsc47b397.c
@@ -298,7 +298,7 @@ static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind)
298 return 0; 298 return 0;
299 299
300error_free: 300error_free:
301 kfree(new_client); 301 kfree(data);
302error_release: 302error_release:
303 release_region(addr, SMSC_EXTENT); 303 release_region(addr, SMSC_EXTENT);
304 return err; 304 return err;
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 897117a7213f..7166ad0b2fda 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -495,7 +495,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
495 return 0; 495 return 0;
496 496
497error_free: 497error_free:
498 kfree(new_client); 498 kfree(data);
499error_release: 499error_release:
500 release_region(address, SMSC_EXTENT); 500 release_region(address, SMSC_EXTENT);
501 return err; 501 return err;