]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: core: Prevent from dereferencing null pointer when releasing SKB
authorMyungho Jung <mhjungk@gmail.com>
Tue, 25 Apr 2017 18:58:15 +0000 (11:58 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Apr 2017 18:47:14 +0000 (14:47 -0400)
Added NULL check to make __dev_kfree_skb_irq consistent with kfree
family of functions.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=195289
Signed-off-by: Myungho Jung <mhjungk@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index 533a6d6f60920a01e8a9cef8fdb408950b914b05..9b5875388c23c4f3306124697fd291c40fb6e6cd 100644 (file)
@@ -2450,6 +2450,9 @@ void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason)
 {
        unsigned long flags;
 
+       if (unlikely(!skb))
+               return;
+
        if (likely(atomic_read(&skb->users) == 1)) {
                smp_rmb();
                atomic_set(&skb->users, 0);