Commit 14c32eee authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

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: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 6b754c8b
...@@ -3976,7 +3976,7 @@ static int io_send(struct io_kiocb *req, bool force_nonblock, ...@@ -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); ret = import_single_range(WRITE, sr->buf, sr->len, &iov, &msg.msg_iter);
if (unlikely(ret)) if (unlikely(ret))
return ret; return ret;;
msg.msg_name = NULL; msg.msg_name = NULL;
msg.msg_control = NULL; msg.msg_control = NULL;
...@@ -4232,10 +4232,8 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock, ...@@ -4232,10 +4232,8 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock,
buf = u64_to_user_ptr(kbuf->addr); buf = u64_to_user_ptr(kbuf->addr);
ret = import_single_range(READ, buf, sr->len, &iov, &msg.msg_iter); ret = import_single_range(READ, buf, sr->len, &iov, &msg.msg_iter);
if (unlikely(ret)) { if (unlikely(ret))
kfree(kbuf); goto out_free;
return ret;
}
req->flags |= REQ_F_NEED_CLEANUP; req->flags |= REQ_F_NEED_CLEANUP;
msg.msg_name = NULL; msg.msg_name = NULL;
...@@ -4256,7 +4254,7 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock, ...@@ -4256,7 +4254,7 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock,
return -EAGAIN; return -EAGAIN;
if (ret == -ERESTARTSYS) if (ret == -ERESTARTSYS)
ret = -EINTR; ret = -EINTR;
out_free:
kfree(kbuf); kfree(kbuf);
req->flags &= ~REQ_F_NEED_CLEANUP; req->flags &= ~REQ_F_NEED_CLEANUP;
if (ret < 0) if (ret < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment