Skip to content

Commit 1e5d770

Browse files
isilenceaxboe
authored andcommitted
io_uring: get an active ref_node from files_data
An active ref_node always can be found in ctx->files_data, it's much safer to get it this way instead of poking into files_data->ref_list. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Cc: stable@vger.kernel.org # v5.7+ Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent c993df5 commit 1e5d770

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

fs/io_uring.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6974,9 +6974,7 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
69746974
return -ENXIO;
69756975

69766976
spin_lock(&data->lock);
6977-
if (!list_empty(&data->ref_list))
6978-
ref_node = list_first_entry(&data->ref_list,
6979-
struct fixed_file_ref_node, node);
6977+
ref_node = data->node;
69806978
spin_unlock(&data->lock);
69816979
if (ref_node)
69826980
percpu_ref_kill(&ref_node->refs);

0 commit comments

Comments
 (0)