2006-03-09 03:12:27

by Dave Jones

[permalink] [raw]
Subject: acpi thermal driver leaks in failure path

Leaking memory in failure path.

Coverity: #601
Signed-off-by: Dave Jones <[email protected]>

--- linux-2.6/drivers/acpi/thermal.c~ 2006-03-08 22:09:51.000000000 -0500
+++ linux-2.6/drivers/acpi/thermal.c 2006-03-08 22:11:05.000000000 -0500
@@ -942,8 +942,10 @@ acpi_thermal_write_trip_points(struct fi
memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN);

active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
- if (!active)
+ if (!active) {
+ kfree(limit_string);
return_VALUE(-ENOMEM);
+ }

if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n"));
--
http://www.codemonkey.org.uk


2006-03-11 03:33:44

by Brown, Len

[permalink] [raw]
Subject: RE: acpi thermal driver leaks in failure path

applied.

thanks,
-Len

>-----Original Message-----
>From: Dave Jones [mailto:[email protected]]
>Sent: Wednesday, March 08, 2006 10:12 PM
>To: Linux Kernel
>Cc: Brown, Len
>Subject: acpi thermal driver leaks in failure path
>
>Leaking memory in failure path.
>
>Coverity: #601
>Signed-off-by: Dave Jones <[email protected]>
>
>--- linux-2.6/drivers/acpi/thermal.c~ 2006-03-08
>22:09:51.000000000 -0500
>+++ linux-2.6/drivers/acpi/thermal.c 2006-03-08
>22:11:05.000000000 -0500
>@@ -942,8 +942,10 @@ acpi_thermal_write_trip_points(struct fi
> memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN);
>
> active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int),
>GFP_KERNEL);
>- if (!active)
>+ if (!active) {
>+ kfree(limit_string);
> return_VALUE(-ENOMEM);
>+ }
>
> if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
> ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n"));
>--
>http://www.codemonkey.org.uk
>