]> git.baikalelectronics.ru Git - kernel.git/commitdiff
io_uring: nospec index for tags on files update
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 6 Apr 2022 11:43:57 +0000 (12:43 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 7 Apr 2022 17:17:47 +0000 (11:17 -0600)
Don't forget to array_index_nospec() for indexes before updating rsrc
tags in __io_sqe_files_update(), just use already safe and precalculated
index @i.

Fixes: e21cc2a576867 ("io_uring: add generic rsrc update with tags")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index a88eca3e0902a706ae97d5422e2f91335dbae1ef..b517fd9c3f6001940568734e5854f7d866a164e3 100644 (file)
@@ -9094,7 +9094,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
                                err = -EBADF;
                                break;
                        }
-                       *io_get_tag_slot(data, up->offset + done) = tag;
+                       *io_get_tag_slot(data, i) = tag;
                        io_fixed_file_set(file_slot, file);
                        err = io_sqe_file_register(ctx, file, i);
                        if (err) {