Skip to content

Commit

Permalink
io_uring: validate the full range of provided buffers for access
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bijan Mottahedeh authored and Jens Axboe committed Jun 8, 2020
1 parent dddb3e2 commit efe68c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -3183,7 +3183,7 @@ static int io_provide_buffers_prep(struct io_kiocb *req,
p->addr = READ_ONCE(sqe->addr);
p->len = READ_ONCE(sqe->len);

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

p->bgid = READ_ONCE(sqe->buf_group);
Expand Down

0 comments on commit efe68c1

Please sign in to comment.