Skip to content

Commit 98dfd50

Browse files
Jiufei Xueaxboe
authored andcommitted
io_uring: fix removing the wrong file in __io_sqe_files_update()
Index here is already the position of the file in fixed_file_table, we should not use io_file_from_index() again to get it. Otherwise, the wrong file which still in use may be released unexpectedly. Cc: [email protected] # v5.6 Fixes: 05f3fb3 ("io_uring: avoid ring quiesce for fixed file set unregister and update") Signed-off-by: Jiufei Xue <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent fdee946 commit 98dfd50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7324,7 +7324,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
73247324
table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT];
73257325
index = i & IORING_FILE_TABLE_MASK;
73267326
if (table->files[index]) {
7327-
file = io_file_from_index(ctx, index);
7327+
file = table->files[index];
73287328
err = io_queue_file_removal(data, file);
73297329
if (err)
73307330
break;

0 commit comments

Comments
 (0)