[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110702211451.GA11378@ericsson.com>
Date: Sat, 2 Jul 2011 14:14:51 -0700
From: Guenter Roeck <guenter.roeck@...csson.com>
To: Jesper Juhl <jj@...osbits.net>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"lm-sensors@...sensors.org" <lm-sensors@...sensors.org>,
Jean Delvare <khali@...ux-fr.org>
Subject: Re: [PATCH] hwmon: Don't leak info in adm1275_probe
On Sat, Jul 02, 2011 at 04:04:29PM -0400, Jesper Juhl wrote:
> In drivers/hwmon/adm1275.c:adm1275_probe() we'll leak the memory
> allocated to 'info' if the call to i2c_smbus_read_byte_data() returns
> less than zero.
>
> This patch fixes the leak by simply calling kfree(info) when needed.
> I also considered just moving the 'info' memory allocation below the
> call to i2c_smbus_read_byte_data(), but I was not sure if it mattered
> to get the -ENOMEM first in that case or if it would be bad to first
> have a successful i2c_smbus_read_byte_data() call and then fail the
> mem alloc, so I stuck with the safe option.
>
> Signed-off-by: Jesper Juhl <jj@...osbits.net>
Hi Jesper,
the fix for this problem is already enqueued as
"hwmon: (adm1275) Free allocated memory if probe function fails".
There is also a second error condition, which occurs if pmbus_do_probe()
returns an error.
Thanks,
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists