io_uring: ensure that io_init_req() passes in the right issue_flags
authorJens Axboe <axboe@kernel.dk>
Fri, 3 Mar 2023 13:49:57 +0000 (06:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Mar 2023 14:14:08 +0000 (15:14 +0100)
We can't use 0 here, as io_init_req() is always invoked with the
ctx uring_lock held. Newer kernels have IO_URING_F_UNLOCKED for this,
but previously we used IO_URING_F_NONBLOCK to indicate this as well.

Fixes: cf7f9cd50013 ("io_uring: add missing lock in io_get_file_fixed")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/io_uring.c

index 7857b3d9d6a7695b0258c08609f38b8d655fd8fa..51d6fbe17f7f34d9efa791becfb77a7bb9048fa9 100644 (file)
@@ -7310,7 +7310,8 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
 
        if (io_op_defs[req->opcode].needs_file) {
                req->file = io_file_get(ctx, req, READ_ONCE(sqe->fd),
-                                       (sqe_flags & IOSQE_FIXED_FILE), 0);
+                                       (sqe_flags & IOSQE_FIXED_FILE),
+                                       IO_URING_F_NONBLOCK);
                if (unlikely(!req->file))
                        ret = -EBADF;
        }