Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755058AbYGGMtp (ORCPT ); Mon, 7 Jul 2008 08:49:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753706AbYGGMtg (ORCPT ); Mon, 7 Jul 2008 08:49:36 -0400 Received: from styx.suse.cz ([82.119.242.94]:32884 "EHLO mail.suse.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752689AbYGGMtf (ORCPT ); Mon, 7 Jul 2008 08:49:35 -0400 Date: Mon, 7 Jul 2008 14:49:34 +0200 (CEST) From: Jiri Kosina To: "Darren Jenkins\\" , Andrew Morton cc: kernel Janitors , LKML , David Sterba Subject: Re: [PATCH] drivers/char/pcmcia/ipwireless/hardware.c fix resource leak In-Reply-To: <1215382690.11092.11.camel@localhost.localdomain> Message-ID: References: <1215382690.11092.11.camel@localhost.localdomain> User-Agent: Alpine 1.10 (LNX 962 2008-03-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="336216065-115667014-1215434974=:3141" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1730 Lines: 56 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --336216065-115667014-1215434974=:3141 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT 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 > > 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 -- Jiri Kosina SUSE Labs --336216065-115667014-1215434974=:3141-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/