提交 e272b89f 编写于 作者: A Al Viro

sg_io(): use import_iovec()

... and don't skip access_ok() validation.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 17d17e72
...@@ -335,16 +335,14 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, ...@@ -335,16 +335,14 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
struct iov_iter i; struct iov_iter i;
struct iovec *iov = NULL; struct iovec *iov = NULL;
ret = rw_copy_check_uvector(-1, hdr->dxferp, hdr->iovec_count, ret = import_iovec(rq_data_dir(rq),
0, NULL, &iov); hdr->dxferp, hdr->iovec_count,
if (ret < 0) { 0, &iov, &i);
kfree(iov); if (ret < 0)
goto out_free_cdb; goto out_free_cdb;
}
/* SG_IO howto says that the shorter of the two wins */ /* SG_IO howto says that the shorter of the two wins */
iov_iter_init(&i, rq_data_dir(rq), iov, hdr->iovec_count, iov_iter_truncate(&i, hdr->dxfer_len);
min_t(unsigned, ret, hdr->dxfer_len));
ret = blk_rq_map_user_iov(q, rq, NULL, &i, GFP_KERNEL); ret = blk_rq_map_user_iov(q, rq, NULL, &i, GFP_KERNEL);
kfree(iov); kfree(iov);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册