summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-11-18 14:56:25 +0000
committerJens Axboe <axboe@kernel.dk>2020-11-18 08:02:10 -0700
commit1e5d770bb8a23dd01e28e92f4fb0b1093c8bdbe6 (patch)
tree2dbe3b19421145c45e65247731b4dc17a672531c /fs/io_uring.c
parentc993df5a688975bf9ce899706ca13d2bc8d6be25 (diff)
downloadlwn-1e5d770bb8a23dd01e28e92f4fb0b1093c8bdbe6.tar.gz
lwn-1e5d770bb8a23dd01e28e92f4fb0b1093c8bdbe6.zip
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>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index b205c1df3f74..5cb194ca4fce 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6974,9 +6974,7 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
return -ENXIO;
spin_lock(&data->lock);
- if (!list_empty(&data->ref_list))
- ref_node = list_first_entry(&data->ref_list,
- struct fixed_file_ref_node, node);
+ ref_node = data->node;
spin_unlock(&data->lock);
if (ref_node)
percpu_ref_kill(&ref_node->refs);