Skip to content

Commit

Permalink
net: core: Prevent from dereferencing null pointer when releasing SKB
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
myunghoj authored and davem330 committed Apr 26, 2017
1 parent 5294b83 commit 9899886
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/core/dev.c
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 9899886

Please sign in to comment.