summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMyungho Jung <mhjungk@gmail.com>2017-04-25 18:58:15 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-08 08:26:07 (GMT)
commit1dee03af7325f8a04954f9114cb76945fddb950c (patch)
tree023a0b90275501ce4e3d05fc4212e5469eba096b /net
parentc593091cfc1bee31b56b555c83dc5f0ed715d7ed (diff)
downloadlinux-1dee03af7325f8a04954f9114cb76945fddb950c.tar.xz
net: core: Prevent from dereferencing null pointer when releasing SKB
[ Upstream commit 9899886d5e8ec5b343b1efe44f185a0e68dc6454 ] 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> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-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 ba7b812..7f2caad 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2355,6 +2355,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);