diff mbox series

libbpf: Fixes incorrect rx_ring_setup_done

Message ID YL4aU4f3Aaik7CN0@linux-dev
State New
Headers show
Series libbpf: Fixes incorrect rx_ring_setup_done | expand

Commit Message

Kev Jackson June 7, 2021, 1:08 p.m. UTC
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.

Signed-off-by: Kev Jackson <foamdino@gmail.com>
---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrii Nakryiko June 8, 2021, 12:45 a.m. UTC | #1
On Mon, Jun 7, 2021 at 8:04 AM Yonghong Song <yhs@fb.com> wrote:
>

>

>

> On 6/7/21 6:08 AM, Kev Jackson wrote:

> > 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.

> >

> > Signed-off-by: Kev Jackson <foamdino@gmail.com>

>

> Acked-by: Yonghong Song <yhs@fb.com>


Applied to bpf tree, thanks. Also added

Fixes: ca7a83e2487a ("libbpf: Only create rx and tx XDP rings when necessary")

Please don't forget Fixes: tag in the future.
patchwork-bot+netdevbpf@kernel.org June 8, 2021, 12:50 a.m. UTC | #2
Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Mon, 7 Jun 2021 14:08:35 +0100 you wrote:
> 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.

> 

> [...]


Here is the summary with links:
  - libbpf: Fixes incorrect rx_ring_setup_done
    https://git.kernel.org/bpf/bpf/c/11fc79fc9f2e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 6061431ee04c..e9b619aa0cdf 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -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);