Skip to content

Commit 94a9976

Browse files
Björn Töpelborkmann
authored andcommitted
xsk: avoid store-tearing when assigning queues
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 <jonathan.lemon@gmail.com> Fixes: 37b0769 ("xsk: add missing write- and data-dependency barrier") Signed-off-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 310f420 commit 94a9976

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/xdp/xsk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static int xsk_init_queue(u32 entries, struct xsk_queue **queue,
434434

435435
/* Make sure queue is ready before it can be seen by others */
436436
smp_wmb();
437-
*queue = q;
437+
WRITE_ONCE(*queue, q);
438438
return 0;
439439
}
440440

0 commit comments

Comments
 (0)