summaryrefslogtreecommitdiffstats
path: root/net/core/xdp.c
diff options
context:
space:
mode:
authorTaehee Yoo <ap420073@gmail.com>2018-07-26 23:17:03 +0900
committerDaniel Borkmann <daniel@iogearbox.net>2018-07-27 03:43:16 +0200
commit36e0f12bbfd3016f495904b35e41c5711707509f (patch)
tree84480035ecd09784ab8398e884c9652a62ed9f6e /net/core/xdp.c
parentd24458e43b103c7eb7b2fd57bcac392fd7750438 (diff)
downloadlinux-36e0f12bbfd3016f495904b35e41c5711707509f.tar.gz
linux-36e0f12bbfd3016f495904b35e41c5711707509f.tar.bz2
linux-36e0f12bbfd3016f495904b35e41c5711707509f.zip
xdp: add NULL pointer check in __xdp_return()
rhashtable_lookup() can return NULL. so that NULL pointer check routine should be added. Fixes: 02b55e5657c3 ("xdp: add MEM_TYPE_ZERO_COPY") Signed-off-by: Taehee Yoo <ap420073@gmail.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net/core/xdp.c')
-rw-r--r--net/core/xdp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/xdp.c b/net/core/xdp.c
index 9d1f22072d5d..6771f1855b96 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -345,7 +345,8 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct,
rcu_read_lock();
/* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */
xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
- xa->zc_alloc->free(xa->zc_alloc, handle);
+ if (!WARN_ON_ONCE(!xa))
+ xa->zc_alloc->free(xa->zc_alloc, handle);
rcu_read_unlock();
default:
/* Not possible, checked in xdp_rxq_info_reg_mem_model() */