Skip to content

Commit

Permalink
libbpf: Fixes incorrect rx_ring_setup_done
Browse files Browse the repository at this point in the history
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: ca7a83e ("libbpf: Only create rx and tx XDP rings when necessary")
Signed-off-by: Kev Jackson <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/bpf/YL4aU4f3Aaik7CN0@linux-dev
  • Loading branch information
foamdino authored and anakryiko committed Jun 8, 2021
1 parent 1a80242 commit 11fc79f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/lib/bpf/xsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,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);
Expand Down

0 comments on commit 11fc79f

Please sign in to comment.