diff options
author | Myungho Jung <mhjungk@gmail.com> | 2017-04-25 11:58:15 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-08 10:11:20 +0200 |
commit | 1728786b2b59b21f33c1d48bc6712779c7303c03 (patch) | |
tree | f20e2c21ae2660a09e7670b96316e89f91dd3562 /net | |
parent | 4c963eff7d9721bca8a3bce19b7733c8b2261685 (diff) | |
download | linux-stable-1728786b2b59b21f33c1d48bc6712779c7303c03.tar.gz linux-stable-1728786b2b59b21f33c1d48bc6712779c7303c03.tar.bz2 linux-stable-1728786b2b59b21f33c1d48bc6712779c7303c03.zip |
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.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 22ad4e433b3a..21b0bd976699 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2225,6 +2225,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); |