From: Eric Dumazet Date: Thu, 19 Nov 2015 20:11:23 +0000 (-0800) Subject: net: avoid NULL deref in napi_get_frags() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e2f9dc3bd213792ac006e83f50a5453f23b8c354;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git net: avoid NULL deref in napi_get_frags() napi_alloc_skb() can return NULL. We should not crash should this happen. Fixes: 93f93a440415 ("net: move skb_mark_napi_id() into core networking stack") Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/net/core/dev.c b/net/core/dev.c index 41cef3e3f558..5df6cbce727c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -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; }