Skip to content

Commit

Permalink
net: avoid NULL deref in napi_get_frags()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 20, 2015
1 parent b3d39a8 commit e2f9dc3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4390,8 +4390,10 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi)

if (!skb) {
skb = napi_alloc_skb(napi, GRO_MAX_HEAD);
napi->skb = skb;
skb_mark_napi_id(skb, napi);
if (skb) {
napi->skb = skb;
skb_mark_napi_id(skb, napi);
}
}
return skb;
}
Expand Down

0 comments on commit e2f9dc3

Please sign in to comment.