Commit 6d2f75a0 authored by Dylan Yudaken's avatar Dylan Yudaken Committed by Jens Axboe
Browse files

io_uring: support 0 length iov in buffer select in compat



Match up work done in "io_uring: allow iov_len = 0 for recvmsg and buffer
select", but for compat code path.

Fixes: a68caad69ce5 ("io_uring: allow iov_len = 0 for recvmsg and buffer select")
Signed-off-by: default avatarDylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220708181838.1495428-3-dylany@fb.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e2df2ccb
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -382,8 +382,12 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req,
	if (req->flags & REQ_F_BUFFER_SELECT) {
		compat_ssize_t clen;

		if (len > 1)
		if (len == 0) {
			sr->len = 0;
			iomsg->free_iov = NULL;
		} else if (len > 1) {
			return -EINVAL;
		} else {
			if (!access_ok(uiov, sizeof(*uiov)))
				return -EFAULT;
			if (__get_user(clen, &uiov->iov_len))
@@ -392,6 +396,7 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req,
				return -EINVAL;
			sr->len = clen;
			iomsg->free_iov = NULL;
		}
	} else {
		iomsg->free_iov = iomsg->fast_iov;
		ret = __import_iovec(READ, (struct iovec __user *)uiov, len,