]> git.baikalelectronics.ru Git - kernel.git/commit
xdp: xdp_mem_allocator can be NULL in trace_mem_connect().
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 9 Mar 2022 22:13:45 +0000 (23:13 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 11 Mar 2022 00:09:29 +0000 (16:09 -0800)
commit6875e1fb85da7151941f102b41f2f2e9d14e6672
tree20e9bb4b586ec66b5627d487283c9176600ae8e8
parentd2584783a1796a0494c929169bec32a3fd5db58e
xdp: xdp_mem_allocator can be NULL in trace_mem_connect().

Since the commit mentioned below __xdp_reg_mem_model() can return a NULL
pointer. This pointer is dereferenced in trace_mem_connect() which leads
to segfault.

The trace points (mem_connect + mem_disconnect) were put in place to
pair connect/disconnect using the IDs. The ID is only assigned if
__xdp_reg_mem_model() does not return NULL. That connect trace point is
of no use if there is no ID.

Skip that connect trace point if xdp_alloc is NULL.

[ Toke Høiland-Jørgensen delivered the reasoning for skipping the trace
  point ]

Fixes: 0fe64b9ac540b ("xdp: Allow registering memory model without rxq reference")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/YikmmXsffE+QajTB@linutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/xdp.c