Re: [PATCH 1/1] staging: gdm72xx: fix an skb memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Wed, Jun 27, 2012 at 12:22:20AM +0200, Javier Martinez Canillas wrote:
> The NLMSG_PUT() macro contains a hidden goto that jumps to the
> nlmsg_failure label. Since the sk_buff was allocated before the macro,
> jumping to the nlmsg_failure label leaks the memory allocated for it.
> 
> Calling kfree() before returning would fix it, but is better to avoid
> using this error prone macro and use nlmsg_put() instead.
> 
> Also, use nlmsg_data() instead of NLMSG_DATA() to check type.
> 
> Signed-off-by: Javier Martinez Canillas <javier@xxxxxxxxxxxx>
> ---
> 
> It just was compiled tested since I don't have the hardware

Nice, thanks for doing this, that's a nasty macro :)

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Video for Linux]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Photos]     [Yosemite Photos]     [Free Singles Community]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Yosemite Backpacking]

Add to Google Powered by Linux