]> Gentwo Git Trees - linux/.git/commitdiff
io_uring: check for user passing 0 nr_submit
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 16 Oct 2025 11:20:31 +0000 (12:20 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 22 Oct 2025 17:12:54 +0000 (11:12 -0600)
io_submit_sqes() shouldn't be stepping into its main loop when there is
nothing to submit, i.e. nr=0. Fix 0 submission queue entries checks,
which should follow after all user input truncations.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c

index be44d636fe1f73709c9f67992e596040bcb38bb6..93a1cc2bf3830479ad8cd8f0f5b936277311cc36 100644 (file)
@@ -2453,10 +2453,11 @@ int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr)
        unsigned int left;
        int ret;
 
+       entries = min(nr, entries);
        if (unlikely(!entries))
                return 0;
-       /* make sure SQ entry isn't read before tail */
-       ret = left = min(nr, entries);
+
+       ret = left = entries;
        io_get_task_refs(left);
        io_submit_state_start(&ctx->submit_state, left);