[PATCH 1/1] staging: gdm72xx: fix an skb memory leak
Greg Kroah-Hartman
gregkh at linuxfoundation.org
Tue Jun 26 22:39:32 UTC 2012
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 at dowhile0.org>
> ---
>
> 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
More information about the devel
mailing list