Skip to content

Commit 531bb98

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: use READ_ONCE with user shared RQEs
Refill queue entries are shared with the user space, use READ_ONCE when reading them. Fixes: 34a3e60 ("io_uring/zcrx: implement zerocopy receive pp memory provider"); Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 9e7dc22 commit 531bb98

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

io_uring/zcrx.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,11 +927,12 @@ static inline bool io_parse_rqe(struct io_uring_zcrx_rqe *rqe,
927927
struct io_zcrx_ifq *ifq,
928928
struct net_iov **ret_niov)
929929
{
930+
__u64 off = READ_ONCE(rqe->off);
930931
unsigned niov_idx, area_idx;
931932
struct io_zcrx_area *area;
932933

933-
area_idx = rqe->off >> IORING_ZCRX_AREA_SHIFT;
934-
niov_idx = (rqe->off & ~IORING_ZCRX_AREA_MASK) >> ifq->niov_shift;
934+
area_idx = off >> IORING_ZCRX_AREA_SHIFT;
935+
niov_idx = (off & ~IORING_ZCRX_AREA_MASK) >> ifq->niov_shift;
935936

936937
if (unlikely(rqe->__pad || area_idx))
937938
return false;

0 commit comments

Comments
 (0)