aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-07-19 18:51:49 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-21 17:47:54 -0400
commit1511022c9aabf253253e35730a6a3b945a2a53a9 (patch)
tree28ced3b034d24f45024bf09e2dcfedd932684c81 /net
parent536d1d4a076210f763b60d7c3823f2edbddf3a9c (diff)
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 <error27@gmail.com> Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/skbuff.c3
1 files changed, 2 insertions, 1 deletions
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)
799 799
800 if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) { 800 if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) {
801 if (skb_copy_ubufs(skb, gfp_mask)) { 801 if (skb_copy_ubufs(skb, gfp_mask)) {
802 kfree(n); 802 kfree_skb(n);
803 n = NULL;
803 goto out; 804 goto out;
804 } 805 }
805 skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY; 806 skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY;