projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d24458e
)
xdp: add NULL pointer check in __xdp_return()
author
Taehee Yoo
<
[email protected]
>
Thu, 26 Jul 2018 14:17:03 +0000
(23:17 +0900)
committer
Daniel Borkmann
<
[email protected]
>
Fri, 27 Jul 2018 01:43:16 +0000
(
03:43
+0200)
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 <
[email protected]
>
Acked-by: Martin KaFai Lau <
[email protected]
>
Acked-by: Björn Töpel <
[email protected]
>
Signed-off-by: Daniel Borkmann <
[email protected]
>
net/core/xdp.c
patch
|
blob
|
history
diff --git
a/net/core/xdp.c
b/net/core/xdp.c
index 9d1f22072d5d5b887b2a0e0bcc35af936ce38778..6771f1855b961b325356c699f6b3190bb188e0ee 100644
(file)
--- 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() */