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>
This commit is contained in:
parent
4e6cdc0a7d
commit
b9ff317b5c
1 changed files with 3 additions and 0 deletions
|
@ -2338,6 +2338,9 @@ void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
if (unlikely(!skb))
|
||||||
|
return;
|
||||||
|
|
||||||
if (likely(atomic_read(&skb->users) == 1)) {
|
if (likely(atomic_read(&skb->users) == 1)) {
|
||||||
smp_rmb();
|
smp_rmb();
|
||||||
atomic_set(&skb->users, 0);
|
atomic_set(&skb->users, 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue