From: J K Cliburn <jcliburn@gmail.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: davem@davemloft.net, linux-kernel@vger.kernel.org,
jirislaby@gmail.com, Chris Snook <chris.snook@gmail.com>,
Jie Yang <jie.yang@atheros.com>,
atl1-devel@lists.sourceforge.net, netdev@vger.kernel.org
Subject: Re: [PATCH 1/1] NET: atlx, fix memory leak
Date: Wed, 6 Jan 2010 18:28:30 -0600 [thread overview]
Message-ID: <20100106182830.4bd861fe@gmail.com> (raw)
In-Reply-To: <1262796856-21919-1-git-send-email-jslaby@suse.cz>
On Wed, 6 Jan 2010 17:54:16 +0100
Jiri Slaby <jslaby@suse.cz> wrote:
> Stanse found a memory leak in atl2_get_eeprom. eeprom_buff is not
> freed/assigned on all paths. Fix that.
Acked by: Jay Cliburn <jcliburn@gmail.com>
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Jay Cliburn <jcliburn@gmail.com>
> Cc: Chris Snook <chris.snook@gmail.com>
> Cc: Jie Yang <jie.yang@atheros.com>
> Cc: atl1-devel@lists.sourceforge.net
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> ---
> drivers/net/atlx/atl2.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
> index c0451d7..ec52529 100644
> --- a/drivers/net/atlx/atl2.c
> +++ b/drivers/net/atlx/atl2.c
> @@ -1959,12 +1959,15 @@ static int atl2_get_eeprom(struct net_device
> *netdev, return -ENOMEM;
>
> for (i = first_dword; i < last_dword; i++) {
> - if (!atl2_read_eeprom(hw, i*4,
> &(eeprom_buff[i-first_dword])))
> - return -EIO;
> + if (!atl2_read_eeprom(hw, i*4,
> &(eeprom_buff[i-first_dword]))) {
> + ret_val = -EIO;
> + goto free;
> + }
> }
>
> memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3),
> eeprom->len);
> +free:
> kfree(eeprom_buff);
>
> return ret_val;
next prev parent reply other threads:[~2010-01-07 0:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-06 16:54 [PATCH 1/1] NET: atlx, fix memory leak Jiri Slaby
2010-01-07 0:28 ` J K Cliburn [this message]
2010-01-07 9:05 ` David Miller
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=20100106182830.4bd861fe@gmail.com \
--to=jcliburn@gmail.com \
--cc=atl1-devel@lists.sourceforge.net \
--cc=chris.snook@gmail.com \
--cc=davem@davemloft.net \
--cc=jie.yang@atheros.com \
--cc=jirislaby@gmail.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).