Skip to content

Commit

Permalink
io_uring: use the proper helpers for io_send/recv
Browse files Browse the repository at this point in the history
Don't use the recvmsg/sendmsg helpers, use the same helpers that the
recv(2) and send(2) system calls use.

Reported-by: 李通洲 <carter.li@eoitek.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Feb 4, 2020
1 parent f0b493e commit 0b7b21e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -3090,7 +3090,8 @@ static int io_send(struct io_kiocb *req, struct io_kiocb **nxt,
else if (force_nonblock)
flags |= MSG_DONTWAIT;

ret = __sys_sendmsg_sock(sock, &msg, flags);
msg.msg_flags = flags;
ret = sock_sendmsg(sock, &msg);
if (force_nonblock && ret == -EAGAIN)
return -EAGAIN;
if (ret == -ERESTARTSYS)
Expand All @@ -3116,6 +3117,7 @@ static int io_recvmsg_prep(struct io_kiocb *req,

sr->msg_flags = READ_ONCE(sqe->msg_flags);
sr->msg = u64_to_user_ptr(READ_ONCE(sqe->addr));
sr->len = READ_ONCE(sqe->len);

if (!io || req->opcode == IORING_OP_RECV)
return 0;
Expand Down Expand Up @@ -3234,7 +3236,7 @@ static int io_recv(struct io_kiocb *req, struct io_kiocb **nxt,
else if (force_nonblock)
flags |= MSG_DONTWAIT;

ret = __sys_recvmsg_sock(sock, &msg, NULL, NULL, flags);
ret = sock_recvmsg(sock, &msg, flags);
if (force_nonblock && ret == -EAGAIN)
return -EAGAIN;
if (ret == -ERESTARTSYS)
Expand Down

0 comments on commit 0b7b21e

Please sign in to comment.