summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-03-22 02:34:53 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-12 05:27:11 +0300
commit32a56afa23e157b444b6c2b943322ea0d119517b (patch)
treeffcc151eba2b440f2a200f9e2e545f0e31570e72 /fs
parent345995fa48c599210fd339a768eb68dead430b79 (diff)
downloadlinux-32a56afa23e157b444b6c2b943322ea0d119517b.tar.xz
aio_setup_vectored_rw(): switch to {compat_,}import_iovec()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/aio.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 3dba5a70ad97..3b8467aeb5ee 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1357,23 +1357,14 @@ static int aio_setup_vectored_rw(int rw, char __user *buf, size_t len,
bool compat,
struct iov_iter *iter)
{
- ssize_t ret;
-
#ifdef CONFIG_COMPAT
if (compat)
- ret = compat_rw_copy_check_uvector(rw,
+ return compat_import_iovec(rw,
(struct compat_iovec __user *)buf,
- len, UIO_FASTIOV, *iovec, iovec);
- else
+ len, UIO_FASTIOV, iovec, iter);
#endif
- ret = rw_copy_check_uvector(rw,
- (struct iovec __user *)buf,
- len, UIO_FASTIOV, *iovec, iovec);
- if (ret < 0)
- return ret;
-
- iov_iter_init(iter, rw, *iovec, len, ret);
- return 0;
+ return import_iovec(rw, (struct iovec __user *)buf,
+ len, UIO_FASTIOV, iovec, iter);
}
/*
@@ -1418,14 +1409,15 @@ rw_common:
if (opcode == IOCB_CMD_PREADV || opcode == IOCB_CMD_PWRITEV)
ret = aio_setup_vectored_rw(rw, buf, len,
&iovec, compat, &iter);
- else
+ else {
ret = import_single_range(rw, buf, len, iovec, &iter);
+ iovec = NULL;
+ }
if (!ret)
ret = rw_verify_area(rw, file, &req->ki_pos,
iov_iter_count(&iter));
if (ret < 0) {
- if (iovec != inline_vecs)
- kfree(iovec);
+ kfree(iovec);
return ret;
}
@@ -1449,6 +1441,7 @@ rw_common:
if (rw == WRITE)
file_end_write(file);
+ kfree(iovec);
break;
case IOCB_CMD_FDSYNC:
@@ -1470,9 +1463,6 @@ rw_common:
return -EINVAL;
}
- if (iovec != inline_vecs)
- kfree(iovec);
-
if (ret != -EIOCBQUEUED) {
/*
* There's no easy way to restart the syscall since other AIO's