Skip to content

Commit e2f9dc3

Browse files
edumazetdavem330
authored andcommitted
net: avoid NULL deref in napi_get_frags()
napi_alloc_skb() can return NULL. We should not crash should this happen. Fixes: 93f93a4 ("net: move skb_mark_napi_id() into core networking stack") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b3d39a8 commit e2f9dc3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/core/dev.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4390,8 +4390,10 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi)
43904390

43914391
if (!skb) {
43924392
skb = napi_alloc_skb(napi, GRO_MAX_HEAD);
4393-
napi->skb = skb;
4394-
skb_mark_napi_id(skb, napi);
4393+
if (skb) {
4394+
napi->skb = skb;
4395+
skb_mark_napi_id(skb, napi);
4396+
}
43954397
}
43964398
return skb;
43974399
}

0 commit comments

Comments
 (0)