Skip to content

Commit

Permalink
xsk: avoid store-tearing when assigning queues
Browse files Browse the repository at this point in the history
Use WRITE_ONCE when doing the store of tx, rx, fq, and cq, to avoid
potential store-tearing. These members are read outside of the control
mutex in the mmap implementation.

Acked-by: Jonathan Lemon <[email protected]>
Fixes: 37b0769 ("xsk: add missing write- and data-dependency barrier")
Signed-off-by: Björn Töpel <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
Björn Töpel authored and borkmann committed Sep 5, 2019
1 parent 310f420 commit 94a9976
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/xdp/xsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ static int xsk_init_queue(u32 entries, struct xsk_queue **queue,

/* Make sure queue is ready before it can be seen by others */
smp_wmb();
*queue = q;
WRITE_ONCE(*queue, q);
return 0;
}

Expand Down

0 comments on commit 94a9976

Please sign in to comment.