summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorMyungho Jung <mhjungk@gmail.com>2017-04-25 11:58:15 -0700
committerDavid S. Miller <davem@davemloft.net>2017-04-26 14:47:14 -0400
commit9899886d5e8ec5b343b1efe44f185a0e68dc6454 (patch)
tree85732488c432e6e70b0fe73e62cfc46370162dae /net/core
parent5294b83086cc1c35b4efeca03644cf9d12282e5b (diff)
downloadlinux-9899886d5e8ec5b343b1efe44f185a0e68dc6454.tar.bz2
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 <mhjungk@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c3
1 files changed, 3 insertions, 0 deletions
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);