summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2023-05-17 12:18:13 -0600
committerJens Axboe <axboe@kernel.dk>2023-05-17 12:18:13 -0600
commit88fc8b8463b024df556d5c4245f2c273f22d83a1 (patch)
tree6335458871dd40108a1a179012d6197cb0d2d9de /io_uring
parentbf34e697931f64b21c82232e98b3d1f566214e40 (diff)
io_uring/net: initalize msghdr->msg_inq to known value
We can't currently tell if ->msg_inq was set when we ask for msg_get_inq, initialize it to -1U so we can tell apart if it was set and there's no data left, or if it just wasn't set at all by the protocol. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/net.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/io_uring/net.c b/io_uring/net.c
index 08fe42673b75..45f9c3046d67 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -785,6 +785,7 @@ retry_multishot:
min_ret = iov_iter_count(&kmsg->msg.msg_iter);
kmsg->msg.msg_get_inq = 1;
+ kmsg->msg.msg_inq = -1U;
if (req->flags & REQ_F_APOLL_MULTISHOT)
ret = io_recvmsg_multishot(sock, sr, kmsg, flags,
&mshot_finished);
@@ -821,7 +822,7 @@ retry_multishot:
io_kbuf_recycle(req, issue_flags);
cflags = io_put_kbuf(req, issue_flags);
- if (kmsg->msg.msg_inq)
+ if (kmsg->msg.msg_inq && kmsg->msg.msg_inq != -1U)
cflags |= IORING_CQE_F_SOCK_NONEMPTY;
if (!io_recv_finish(req, &ret, cflags, mshot_finished, issue_flags))
@@ -882,6 +883,7 @@ retry_multishot:
if (unlikely(ret))
goto out_free;
+ msg.msg_inq = -1U;
msg.msg_flags = 0;
flags = sr->msg_flags;
@@ -923,7 +925,7 @@ out_free:
io_kbuf_recycle(req, issue_flags);
cflags = io_put_kbuf(req, issue_flags);
- if (msg.msg_inq)
+ if (msg.msg_inq && msg.msg_inq != -1U)
cflags |= IORING_CQE_F_SOCK_NONEMPTY;
if (!io_recv_finish(req, &ret, cflags, ret <= 0, issue_flags))