summaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-07-16 22:28:01 +0200
committerJens Axboe <axboe@kernel.dk>2020-07-24 21:00:45 +0200
commit14c32eee9286621dd437b53460e44bd11e5bc08d (patch)
tree98f408351dc8bb4fbdcf4879db5df7c3da64a80c /fs/io_uring.c
parentio_uring: remove extra checks in send/recv (diff)
downloadlinux-14c32eee9286621dd437b53460e44bd11e5bc08d.tar.xz
linux-14c32eee9286621dd437b53460e44bd11e5bc08d.zip
io_uring: don't forget cflags in io_recv()
Instead of returning error from io_recv(), go through generic cleanup path, because it'll retain cflags for userspace. Do the same for io_send() for consistency. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index ac3c16ea7d23..2ffacfbf9094 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3976,7 +3976,7 @@ static int io_send(struct io_kiocb *req, bool force_nonblock,
ret = import_single_range(WRITE, sr->buf, sr->len, &iov, &msg.msg_iter);
if (unlikely(ret))
- return ret;
+ return ret;;
msg.msg_name = NULL;
msg.msg_control = NULL;
@@ -4232,10 +4232,8 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock,
buf = u64_to_user_ptr(kbuf->addr);
ret = import_single_range(READ, buf, sr->len, &iov, &msg.msg_iter);
- if (unlikely(ret)) {
- kfree(kbuf);
- return ret;
- }
+ if (unlikely(ret))
+ goto out_free;
req->flags |= REQ_F_NEED_CLEANUP;
msg.msg_name = NULL;
@@ -4256,7 +4254,7 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock,
return -EAGAIN;
if (ret == -ERESTARTSYS)
ret = -EINTR;
-
+out_free:
kfree(kbuf);
req->flags &= ~REQ_F_NEED_CLEANUP;
if (ret < 0)