Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 34a3e60821ab9 ("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>

authored by

Pavel Begunkov and committed by
Jens Axboe
531bb98a 9e7dc228

+3 -2
+3 -2
io_uring/zcrx.c
··· 927 927 struct io_zcrx_ifq *ifq, 928 928 struct net_iov **ret_niov) 929 929 { 930 + __u64 off = READ_ONCE(rqe->off); 930 931 unsigned niov_idx, area_idx; 931 932 struct io_zcrx_area *area; 932 933 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; 935 936 936 937 if (unlikely(rqe->__pad || area_idx)) 937 938 return false;