提交 f48b6274 编写于 作者: B Bijan Mottahedeh 提交者: Xiaoguang Wang

io_uring: validate the full range of provided buffers for access

to #28736503

commit efe68c1ca8f49e8c06afd74b699411bfbb8ba1ff upstream

Account for the number of provided buffers when validating the address
range.
Signed-off-by: NBijan Mottahedeh <bijan.mottahedeh@oracle.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 616bb4fd
......@@ -3174,7 +3174,8 @@ 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(VERIFY_WRITE, u64_to_user_ptr(p->addr), p->len))
if (!access_ok(VERIFY_WRITE, u64_to_user_ptr(p->addr),
p->len * p->nbufs))
return -EFAULT;
p->bgid = READ_ONCE(sqe->buf_group);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册