提交 2d606ae0 编写于 作者: P Pavel Begunkov 提交者: Cheng Jian

io_uring: get an active ref_node from files_data

mainline inclusion
from mainline-5.10-rc5
commit 1e5d770b
category: feature
bugzilla: 27
CVE: NA
---------------------------

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: NPavel Begunkov <asml.silence@gmail.com>
Cc: stable@vger.kernel.org # v5.7+
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: Nyangerkun <yangerkun@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 a5cb8408
...@@ -6633,9 +6633,7 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx) ...@@ -6633,9 +6633,7 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
return -ENXIO; return -ENXIO;
spin_lock(&data->lock); spin_lock(&data->lock);
if (!list_empty(&data->ref_list)) ref_node = data->node;
ref_node = list_first_entry(&data->ref_list,
struct fixed_file_ref_node, node);
spin_unlock(&data->lock); spin_unlock(&data->lock);
if (ref_node) if (ref_node)
percpu_ref_kill(&ref_node->refs); percpu_ref_kill(&ref_node->refs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册