Commit e2f9dc3b authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: avoid NULL deref in napi_get_frags()

napi_alloc_skb() can return NULL.
We should not crash should this happen.

Fixes: 93f93a44 ("net: move skb_mark_napi_id() into core networking stack")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b3d39a88
...@@ -4390,9 +4390,11 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi) ...@@ -4390,9 +4390,11 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi)
if (!skb) { if (!skb) {
skb = napi_alloc_skb(napi, GRO_MAX_HEAD); skb = napi_alloc_skb(napi, GRO_MAX_HEAD);
if (skb) {
napi->skb = skb; napi->skb = skb;
skb_mark_napi_id(skb, napi); skb_mark_napi_id(skb, napi);
} }
}
return skb; return skb;
} }
EXPORT_SYMBOL(napi_get_frags); EXPORT_SYMBOL(napi_get_frags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment