summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorDylan Yudaken <dylany@fb.com>2022-07-08 11:18:36 -0700
committerJens Axboe <axboe@kernel.dk>2022-07-24 18:39:17 -0600
commit6d2f75a0cf3048ef38c48493f66a923353bf664b (patch)
tree01fe20b3fd18fbdd07caea3ee82116d0f82a22f6 /io_uring
parente2df2ccb753e3b598a9045760e79f1847f7b31cd (diff)
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: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220708181838.1495428-3-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/net.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/io_uring/net.c b/io_uring/net.c
index eb939899e9c5..dc9190eafbe7 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -382,16 +382,21 @@ 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)
- return -EINVAL;
- if (!access_ok(uiov, sizeof(*uiov)))
- return -EFAULT;
- if (__get_user(clen, &uiov->iov_len))
- return -EFAULT;
- if (clen < 0)
+ if (len == 0) {
+ sr->len = 0;
+ iomsg->free_iov = NULL;
+ } else if (len > 1) {
return -EINVAL;
- sr->len = clen;
- iomsg->free_iov = NULL;
+ } else {
+ if (!access_ok(uiov, sizeof(*uiov)))
+ return -EFAULT;
+ if (__get_user(clen, &uiov->iov_len))
+ return -EFAULT;
+ if (clen < 0)
+ 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,