lkml.org 
[lkml]   [2012]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] bnx2x: Fix mem leak in bnx2x_tpa_stop() if build_skb() fails.
From
From: "Eilon Greenstein" <eilong@broadcom.com>
Date: Tue, 7 Feb 2012 08:55:01 +0200

> On Mon, 2012-02-06 at 23:53 +0100, Eric Dumazet wrote:
>> Le lundi 06 février 2012 à 22:28 +0100, Jesper Juhl a écrit :
>> > We allocate memory for 'new_data' with kmalloc(). If we get the memory
>> > we then try to build_skb() and if that should fail (which it can) we
>> > do not enter 'if (likely(skb)) {' and actually use 'new_data' but
>> > instead fall through to the 'drop:' label and end up returning from
>> > the function without ever assigning 'new'data' to anything or freeing
>> > it. That leaks the memory allocated to 'new_data'.
>> >
>> > This patch fixes the memory leak by doing a kfree(new_data) in the
>> > case where build_skb() fails (or where allocation of 'new_data' itself
>> > fails, but in taht case it's just a harmless kfree(NULL)).
>> >
>> > Signed-off-by: Jesper Juhl <jj@chaosbits.net>
...
>> Good catch, my bad.
>>
>> Thanks
>>
>> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
>
> Indeed - nice catch. Thanks Jesper.
>
> Acked-by: Eilon Greenstein <eilong@broadcom.com>

Applied, thanks everyone.
--
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/

\
 
 \ /
  Last update: 2012-02-07 19:17    [W:0.301 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site