Commit 43f77e91 authored by Darren Jenkins's avatar Darren Jenkins Committed by Linus Torvalds

drivers/char/pcmcia/ipwireless/hardware.c fix resource leak

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: default avatarDarren Jenkins <darrenrjenkins@gmail.com>
Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a26929fb
...@@ -590,8 +590,10 @@ static struct ipw_rx_packet *pool_allocate(struct ipw_hardware *hw, ...@@ -590,8 +590,10 @@ static struct ipw_rx_packet *pool_allocate(struct ipw_hardware *hw,
packet = kmalloc(sizeof(struct ipw_rx_packet) + packet = kmalloc(sizeof(struct ipw_rx_packet) +
old_packet->length + minimum_free_space, old_packet->length + minimum_free_space,
GFP_ATOMIC); GFP_ATOMIC);
if (!packet) if (!packet) {
kfree(old_packet);
return NULL; return NULL;
}
memcpy(packet, old_packet, memcpy(packet, old_packet,
sizeof(struct ipw_rx_packet) sizeof(struct ipw_rx_packet)
+ old_packet->length); + old_packet->length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment