projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
016983d
)
hwmon: (acpi_power_meter) Fix potential memory leak in acpi_power_meter_add()
author
Misono Tomohiro
<misono.tomohiro@jp.fujitsu.com>
Thu, 25 Jun 2020 04:32:42 +0000
(13:32 +0900)
committer
Guenter Roeck
<linux@roeck-us.net>
Thu, 25 Jun 2020 23:06:06 +0000
(16:06 -0700)
Although it rarely happens, we should call free_capabilities()
if error happens after read_capabilities() to free allocated strings.
Fixes:
de584afa5e188
("hwmon driver for ACPI 4.0 power meters")
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Link:
https://lore.kernel.org/r/20200625043242.31175-1-misono.tomohiro@jp.fujitsu.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/acpi_power_meter.c
patch
|
blob
|
history
diff --git
a/drivers/hwmon/acpi_power_meter.c
b/drivers/hwmon/acpi_power_meter.c
index
0db8ef4
..
a270b97
100644
(file)
--- a/
drivers/hwmon/acpi_power_meter.c
+++ b/
drivers/hwmon/acpi_power_meter.c
@@
-883,7
+883,7
@@
static int acpi_power_meter_add(struct acpi_device *device)
res = setup_attrs(resource);
if (res)
- goto exit_free;
+ goto exit_free
_capability
;
resource->hwmon_dev = hwmon_device_register(&device->dev);
if (IS_ERR(resource->hwmon_dev)) {
@@
-896,6
+896,8
@@
static int acpi_power_meter_add(struct acpi_device *device)
exit_remove:
remove_attrs(resource);
+exit_free_capability:
+ free_capabilities(resource);
exit_free:
kfree(resource);
exit: