lkml.org 
[lkml]   [2008]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] drivers/char/pcmcia/ipwireless/hardware.c fix resource leak
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
\
 
 \ /
  Last update: 2008-07-07 14:51    [W:0.035 / U:1.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site