summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKev Jackson <foamdino@gmail.com>2021-06-07 14:08:35 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-23 14:43:55 +0200
commitc54a64e7c0accd096e0b2ec7b61379a19ba0106e (patch)
tree9ef86a0ef1df32deb9e464627458b854974682e6 /tools
parentffc6be4cb86133ddb1c398bc3b3ca5207026d1c0 (diff)
downloadlinux-c54a64e7c0accd096e0b2ec7b61379a19ba0106e.tar.gz
linux-c54a64e7c0accd096e0b2ec7b61379a19ba0106e.tar.bz2
linux-c54a64e7c0accd096e0b2ec7b61379a19ba0106e.zip
libbpf: Fixes incorrect rx_ring_setup_done
[ Upstream commit 11fc79fc9f2e395aa39fa5baccae62767c5d8280 ] When calling xsk_socket__create_shared(), the logic at line 1097 marks a boolean flag true within the xsk_umem structure to track setup progress in order to support multiple calls to the function. However, instead of marking umem->tx_ring_setup_done, the code incorrectly sets umem->rx_ring_setup_done. This leads to improper behaviour when creating and destroying xsk and umem structures. Multiple calls to this function is documented as supported. Fixes: ca7a83e2487a ("libbpf: Only create rx and tx XDP rings when necessary") Signed-off-by: Kev Jackson <foamdino@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/YL4aU4f3Aaik7CN0@linux-dev Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/bpf/xsk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 007fe5d59438..fe2bec500bf6 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -928,7 +928,7 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr,
goto out_put_ctx;
}
if (xsk->fd == umem->fd)
- umem->rx_ring_setup_done = true;
+ umem->tx_ring_setup_done = true;
}
err = xsk_get_mmap_offsets(xsk->fd, &off);