All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
	Jean Delvare <khali@linux-fr.org>
Subject: Re: [lm-sensors] [PATCH] hwmon: Don't leak info in adm1275_probe
Date: Sat, 02 Jul 2011 21:14:51 +0000	[thread overview]
Message-ID: <20110702211451.GA11378@ericsson.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1107022202520.16316@swampdragon.chaosbits.net>

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@chaosbits.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

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
	Jean Delvare <khali@linux-fr.org>
Subject: Re: [PATCH] hwmon: Don't leak info in adm1275_probe
Date: Sat, 2 Jul 2011 14:14:51 -0700	[thread overview]
Message-ID: <20110702211451.GA11378@ericsson.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1107022202520.16316@swampdragon.chaosbits.net>

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@chaosbits.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

  reply	other threads:[~2011-07-02 21:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-02 20:04 [lm-sensors] [PATCH] hwmon: Don't leak info in adm1275_probe Jesper Juhl
2011-07-02 20:04 ` Jesper Juhl
2011-07-02 21:14 ` Guenter Roeck [this message]
2011-07-02 21:14   ` Guenter Roeck
2011-07-02 21:18   ` [lm-sensors] " Jesper Juhl
2011-07-02 21:18     ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110702211451.GA11378@ericsson.com \
    --to=guenter.roeck@ericsson.com \
    --cc=jj@chaosbits.net \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.