Skip to content

Commit 85f6c43

Browse files
isilenceaxboe
authored andcommitted
io_uring/timeout: READ_ONCE sqe->addr
We should use READ_ONCE when reading from a SQE, make sure timeout gets a stable timespec address. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent a464355 commit 85f6c43

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

io_uring/timeout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ int io_timeout_remove_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
462462
tr->ltimeout = true;
463463
if (tr->flags & ~(IORING_TIMEOUT_UPDATE_MASK|IORING_TIMEOUT_ABS))
464464
return -EINVAL;
465-
if (get_timespec64(&tr->ts, u64_to_user_ptr(sqe->addr2)))
465+
if (get_timespec64(&tr->ts, u64_to_user_ptr(READ_ONCE(sqe->addr2))))
466466
return -EFAULT;
467467
if (tr->ts.tv_sec < 0 || tr->ts.tv_nsec < 0)
468468
return -EINVAL;
@@ -557,7 +557,7 @@ static int __io_timeout_prep(struct io_kiocb *req,
557557
data->req = req;
558558
data->flags = flags;
559559

560-
if (get_timespec64(&data->ts, u64_to_user_ptr(sqe->addr)))
560+
if (get_timespec64(&data->ts, u64_to_user_ptr(READ_ONCE(sqe->addr))))
561561
return -EFAULT;
562562

563563
if (data->ts.tv_sec < 0 || data->ts.tv_nsec < 0)

0 commit comments

Comments
 (0)