Commit 36e0f12b authored by Taehee Yoo's avatar Taehee Yoo Committed by Daniel Borkmann

xdp: add NULL pointer check in __xdp_return()

rhashtable_lookup() can return NULL. so that NULL pointer
check routine should be added.

Fixes: 02b55e56 ("xdp: add MEM_TYPE_ZERO_COPY")
Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Acked-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent d24458e4
...@@ -345,6 +345,7 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct, ...@@ -345,6 +345,7 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct,
rcu_read_lock(); rcu_read_lock();
/* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */ /* 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 = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
if (!WARN_ON_ONCE(!xa))
xa->zc_alloc->free(xa->zc_alloc, handle); xa->zc_alloc->free(xa->zc_alloc, handle);
rcu_read_unlock(); rcu_read_unlock();
default: default:
......
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