summaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-11-19 21:11:23 +0100
committerDavid S. Miller <davem@davemloft.net>2015-11-20 22:43:14 +0100
commite2f9dc3bd213792ac006e83f50a5453f23b8c354 (patch)
tree7c97168cccbbfbe77d52ce0c083fc3dff0d075c7 /net/core/dev.c
parentravb: use clock rate as basis for GTI.TIV (diff)
downloadlinux-e2f9dc3bd213792ac006e83f50a5453f23b8c354.tar.xz
linux-e2f9dc3bd213792ac006e83f50a5453f23b8c354.zip
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 <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c6
1 files changed, 4 insertions, 2 deletions
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;
}