diff options
author | Christoph Hellwig <hch@lst.de> | 2020-09-25 06:51:41 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-10-03 00:02:13 -0400 |
commit | 89cd35c58bc2e36bfdc23dde67a429b08cf4ae03 (patch) | |
tree | 540a413bab63b20e24dba2dece0044277bb778a1 /fs/io_uring.c | |
parent | bfdc59701d6d100c99c3b987bcffd1c204e393c8 (diff) | |
download | linux-89cd35c58bc2e36bfdc23dde67a429b08cf4ae03.tar.bz2 |
iov_iter: transparently handle compat iovecs in import_iovec
Use in compat_syscall to import either native or the compat iovecs, and
remove the now superflous compat_import_iovec.
This removes the need for special compat logic in most callers, and
the remaining ones can still be simplified by using __import_iovec
with a bool compat parameter.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 91e2cc8414f9..b75c699b5cb7 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2846,13 +2846,8 @@ static ssize_t __io_import_iovec(int rw, struct io_kiocb *req, return ret; } -#ifdef CONFIG_COMPAT - if (req->ctx->compat) - return compat_import_iovec(rw, buf, sqe_len, UIO_FASTIOV, - iovec, iter); -#endif - - return import_iovec(rw, buf, sqe_len, UIO_FASTIOV, iovec, iter); + return __import_iovec(rw, buf, sqe_len, UIO_FASTIOV, iovec, iter, + req->ctx->compat); } static ssize_t io_import_iovec(int rw, struct io_kiocb *req, @@ -4166,8 +4161,9 @@ static int __io_recvmsg_copy_hdr(struct io_kiocb *req, sr->len); iomsg->iov = NULL; } else { - ret = import_iovec(READ, uiov, iov_len, UIO_FASTIOV, - &iomsg->iov, &iomsg->msg.msg_iter); + ret = __import_iovec(READ, uiov, iov_len, UIO_FASTIOV, + &iomsg->iov, &iomsg->msg.msg_iter, + false); if (ret > 0) ret = 0; } @@ -4207,9 +4203,9 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req, sr->len = iomsg->iov[0].iov_len; iomsg->iov = NULL; } else { - ret = compat_import_iovec(READ, uiov, len, UIO_FASTIOV, - &iomsg->iov, - &iomsg->msg.msg_iter); + ret = __import_iovec(READ, (struct iovec __user *)uiov, len, + UIO_FASTIOV, &iomsg->iov, + &iomsg->msg.msg_iter, true); if (ret < 0) return ret; } |