From: Myungho Jung Date: Tue, 25 Apr 2017 18:58:15 +0000 (-0700) Subject: net: core: Prevent from dereferencing null pointer when releasing SKB X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9899886d5e8ec5b343b1efe44f185a0e68dc6454;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git net: core: Prevent from dereferencing null pointer when releasing SKB 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 Signed-off-by: David S. Miller --- diff --git a/net/core/dev.c b/net/core/dev.c index 533a6d6f6092..9b5875388c23 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -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);