diff mbox series

[1/3] io_uring/net: fix accept multishot handling

Message ID 51c6deb01feaa78b08565ca8f24843c017f5bc80.1740331076.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series multishot improvements | expand

Commit Message

Pavel Begunkov Feb. 23, 2025, 5:22 p.m. UTC
REQ_F_APOLL_MULTISHOT doesn't guarantee it's executed from the multishot
context, so a multishot accept may get executed inline, fail
io_req_post_cqe(), and ask the core code to kill the request with
-ECANCELED by returning IOU_STOP_MULTISHOT even when a socket has been
accepted and installed.

Cc: stable@vger.kernel.org
Fixes: 390ed29b5e425 ("io_uring: add IORING_ACCEPT_MULTISHOT for accept")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/net.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/io_uring/net.c b/io_uring/net.c
index 000dc70d08d0..657b8f5341cf 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1718,6 +1718,8 @@  int io_accept(struct io_kiocb *req, unsigned int issue_flags)
 	}
 
 	io_req_set_res(req, ret, cflags);
+	if (!(issue_flags & IO_URING_F_MULTISHOT))
+		return IOU_OK;
 	return IOU_STOP_MULTISHOT;
 }