mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Kosina <jkosina@suse.cz>
To: "Darren Jenkins\\" <darrenrjenkins@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: kernel Janitors <kernel-janitors@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	David Sterba <dsterba@suse.cz>
Subject: Re: [PATCH] drivers/char/pcmcia/ipwireless/hardware.c fix resource leak
Date: Mon, 7 Jul 2008 14:49:34 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LNX.1.10.0807071447470.3141@jikos.suse.cz> (raw)
In-Reply-To: <1215382690.11092.11.camel@localhost.localdomain>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1164 bytes --]

On Mon, 7 Jul 2008, Darren Jenkins\ wrote:

> G'day people,
>
> Coverity CID: 2172 RESOURCE_LEAK
>
> When pool_allocate() tries to enlarge a packet, if it can not allocate
> enough memory, it returns NULL without first freeing the old packet.
>
> This patch just frees the packet first.
>
> Signed-off-by: Darren Jenkins <darrenrjenkins@gmailcom>
>
> diff --git a/drivers/char/pcmcia/ipwireless/hardware.c b/drivers/char/pcmcia/ipwireless/hardware.c
> index ba6340a..929101e 100644
> --- a/drivers/char/pcmcia/ipwireless/hardware.c
> +++ b/drivers/char/pcmcia/ipwireless/hardware.c
> @@ -590,8 +590,10 @@ static struct ipw_rx_packet *pool_allocate(struct ipw_hardware *hw,
> 		packet = kmalloc(sizeof(struct ipw_rx_packet) +
> 				old_packet->length + minimum_free_space,
> 				GFP_ATOMIC);
> -		if (!packet)
> +		if (!packet) {
> +			kfree(old_packet);
> 			return NULL;
> +		}
> 		memcpy(packet, old_packet,
> 				sizeof(struct ipw_rx_packet)
> 					+ old_packet->length);
>
>
>

Thanks a lot for reporting this, Darren.

Andrew, could you please push this through -mm? Thanks.


 	Signed-off-by: Jiri Kosina <jkosina@suse.cz>

-- 
Jiri Kosina
SUSE Labs

      reply	other threads:[~2008-07-07 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-06 22:18 Darren Jenkins\
2008-07-07 12:49 ` Jiri Kosina [this message]

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=alpine.LNX.1.10.0807071447470.3141@jikos.suse.cz \
    --to=jkosina@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=darrenrjenkins@gmail.com \
    --cc=dsterba@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®