Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Darren Jenkins <darrenrjenkins@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Darren Jenkins and committed by
Linus Torvalds
43f77e91 a26929fb

+3 -1
+3 -1
drivers/char/pcmcia/ipwireless/hardware.c
··· 590 590 packet = kmalloc(sizeof(struct ipw_rx_packet) + 591 591 old_packet->length + minimum_free_space, 592 592 GFP_ATOMIC); 593 - if (!packet) 593 + if (!packet) { 594 + kfree(old_packet); 594 595 return NULL; 596 + } 595 597 memcpy(packet, old_packet, 596 598 sizeof(struct ipw_rx_packet) 597 599 + old_packet->length);