Merge git://git.infradead.org/users/eparis/audit
[firefly-linux-kernel-4.4.55.git] / include / linux / skbuff.h
index 3ab0749d6875c5032b12d3188b8420ac97797c8e..a59d9343c25bdc9575eefa1ac361732599db9ddf 100644 (file)
@@ -1203,7 +1203,12 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
        might_sleep_if(pri & __GFP_WAIT);
        if (skb_cloned(skb)) {
                struct sk_buff *nskb = skb_copy(skb, pri);
-               kfree_skb(skb); /* Free our shared copy */
+
+               /* Free our shared copy */
+               if (likely(nskb))
+                       consume_skb(skb);
+               else
+                       kfree_skb(skb);
                skb = nskb;
        }
        return skb;