]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring/net: fix accept multishot handling
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 23 Feb 2025 17:22:29 +0000 (17:22 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 24 Feb 2025 19:11:06 +0000 (12:11 -0700)
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>
Link: https://lore.kernel.org/r/51c6deb01feaa78b08565ca8f24843c017f5bc80.1740331076.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/net.c

index 1d1107fd5beb0d4ccd1de080df0d25cdf1d12477..926cdb8d3350c1eea13fcf588047ba8689e3cfea 100644 (file)
@@ -1641,6 +1641,8 @@ retry:
        }
 
        io_req_set_res(req, ret, cflags);
+       if (!(issue_flags & IO_URING_F_MULTISHOT))
+               return IOU_OK;
        return IOU_STOP_MULTISHOT;
 }