summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/google
diff options
context:
space:
mode:
authorAmeer Hamza <amhamza.mgc@gmail.com>2021-12-05 21:38:10 +0300
committerJakub Kicinski <kuba@kernel.org>2021-12-08 07:57:17 +0300
commite6f60c51f0435862020bcd2d1e3257caaafe5650 (patch)
tree7fcbead3e075c414d5149ef2337269e0bde79302 /drivers/net/ethernet/google
parent6ebe4b350833a535d1df02591911b5f5fba3b275 (diff)
downloadlinux-e6f60c51f0435862020bcd2d1e3257caaafe5650.tar.xz
gve: fix for null pointer dereference.
Avoid passing NULL skb to __skb_put() function call if napi_alloc_skb() returns NULL. Fixes: 37149e9374bf ("gve: Implement packet continuation for RX.") Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com> Link: https://lore.kernel.org/r/20211205183810.8299-1-amhamza.mgc@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/google')
-rw-r--r--drivers/net/ethernet/google/gve/gve_utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/google/gve/gve_utils.c b/drivers/net/ethernet/google/gve/gve_utils.c
index 88ca49cbc1e2..d57508bc4307 100644
--- a/drivers/net/ethernet/google/gve/gve_utils.c
+++ b/drivers/net/ethernet/google/gve/gve_utils.c
@@ -68,6 +68,9 @@ struct sk_buff *gve_rx_copy(struct net_device *dev, struct napi_struct *napi,
set_protocol = ctx->curr_frag_cnt == ctx->expected_frag_cnt - 1;
} else {
skb = napi_alloc_skb(napi, len);
+
+ if (unlikely(!skb))
+ return NULL;
set_protocol = true;
}
__skb_put(skb, len);