diff options
| author | Magnus Karlsson <[email protected]> | 2020-09-02 09:06:09 +0000 |
|---|---|---|
| committer | Daniel Borkmann <[email protected]> | 2020-09-02 14:52:59 +0000 |
| commit | 968be23ceaca1f402dfad0a30a8da4649ee32940 (patch) | |
| tree | 0353a5910df22b624f02fba72f5d103baa6e35d2 /tools/testing/selftests/bpf/prog_tests/global_data_init.c | |
| parent | xsk: Fix possible segfault in xsk umem diagnostics (diff) | |
| download | kernel-968be23ceaca1f402dfad0a30a8da4649ee32940.tar.gz kernel-968be23ceaca1f402dfad0a30a8da4649ee32940.zip | |
xsk: Fix possible segfault at xskmap entry insertion
Fix possible segfault when entry is inserted into xskmap. This can
happen if the socket is in a state where the umem has been set up, the
Rx ring created but it has yet to be bound to a device. In this case
the pool has not yet been created and we cannot reference it for the
existence of the fill ring. Fix this by removing the whole
xsk_is_setup_for_bpf_map function. Once upon a time, it was used to
make sure that the Rx and fill rings where set up before the driver
could call xsk_rcv, since there are no tests for the existence of
these rings in the data path. But these days, we have a state variable
that we test instead. When it is XSK_BOUND, everything has been set up
correctly and the socket has been bound. So no reason to have the
xsk_is_setup_for_bpf_map function anymore.
Fixes: 7361f9c3d719 ("xsk: Move fill and completion rings to buffer pool")
Reported-by: [email protected]
Signed-off-by: Magnus Karlsson <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/global_data_init.c')
0 files changed, 0 insertions, 0 deletions
