io_uring: ignore ->buf_index if REQ_F_BUFFER_SELECT isn't set
authorJens Axboe <axboe@kernel.dk>
Fri, 29 Apr 2022 15:25:12 +0000 (09:25 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 9 May 2022 12:29:06 +0000 (06:29 -0600)
There's no point in validity checking buf_index if the request doesn't
have REQ_F_BUFFER_SELECT set, as we will never use it for that case.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index e13316969e9ecb003f9a6cb7f5189b11c1c020d9..bd0ee2f7df2c9f085bdb6dd8745d8010394b4f5e 100644 (file)
@@ -3573,10 +3573,6 @@ static struct iovec *__io_import_iovec(int rw, struct io_kiocb *req,
                return NULL;
        }
 
-       /* buffer index only valid with fixed read/write, or buffer select  */
-       if (unlikely(req->buf_index && !(req->flags & REQ_F_BUFFER_SELECT)))
-               return ERR_PTR(-EINVAL);
-
        buf = u64_to_user_ptr(req->rw.addr);
        sqe_len = req->rw.len;