From: Dan Carpenter Date: Tue, 19 Jul 2011 22:51:49 +0000 (+0000) Subject: skbuff: fix error handling in pskb_copy() X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=1511022c9aabf253253e35730a6a3b945a2a53a9;p=openwrt%2Fstaging%2Fblogic.git skbuff: fix error handling in pskb_copy() There are two problems: 1) "n" was allocated with alloc_skb() so we should free it with kfree_skb() instead of regular kfree(). 2) We return the freed pointer instead of NULL. Signed-off-by: Dan Carpenter Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/net/core/skbuff.c b/net/core/skbuff.c index d220119f13ab..2beda824636e 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -799,7 +799,8 @@ struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask) if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) { if (skb_copy_ubufs(skb, gfp_mask)) { - kfree(n); + kfree_skb(n); + n = NULL; goto out; } skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY;