Skip to content

Commit efe68c1

Browse files
Bijan Mottahedehaxboe
authored andcommitted
io_uring: validate the full range of provided buffers for access
Account for the number of provided buffers when validating the address range. Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent dddb3e2 commit efe68c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3183,7 +3183,7 @@ static int io_provide_buffers_prep(struct io_kiocb *req,
31833183
p->addr = READ_ONCE(sqe->addr);
31843184
p->len = READ_ONCE(sqe->len);
31853185

3186-
if (!access_ok(u64_to_user_ptr(p->addr), p->len))
3186+
if (!access_ok(u64_to_user_ptr(p->addr), (p->len * p->nbufs)))
31873187
return -EFAULT;
31883188

31893189
p->bgid = READ_ONCE(sqe->buf_group);

0 commit comments

Comments
 (0)