Skip to content

Commit b9ff317

Browse files
myunghojgregkh
authored andcommitted
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>
1 parent 4e6cdc0 commit b9ff317

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/core/dev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,9 @@ void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason)
23382338
{
23392339
unsigned long flags;
23402340

2341+
if (unlikely(!skb))
2342+
return;
2343+
23412344
if (likely(atomic_read(&skb->users) == 1)) {
23422345
smp_rmb();
23432346
atomic_set(&skb->users, 0);

0 commit comments

Comments
 (0)