lkml.org 
[lkml]   [2022]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.17 253/343] io_uring: nospec index for tags on files update
    Date
    From: Pavel Begunkov <asml.silence@gmail.com>

    [ Upstream commit 34bb77184123ae401100a4d156584f12fa630e5c ]

    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: c3bdad0271834 ("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>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    fs/io_uring.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/fs/io_uring.c b/fs/io_uring.c
    index 5e6788ab188f..a3e82aececd9 100644
    --- a/fs/io_uring.c
    +++ b/fs/io_uring.c
    @@ -8700,7 +8700,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) {
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-04-12 10:58    [W:4.233 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site