Add io_rsrc_data_free() helper for destroying rsrc_data, easier for search and the function will get more stuff to destroy shortly. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- fs/io_uring.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 70e331349213..a1f89340e844 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7109,6 +7109,11 @@ static int io_rsrc_ref_quiesce(struct io_rsrc_data *data, struct io_ring_ctx *ct return ret; } +static void io_rsrc_data_free(struct io_rsrc_data *data) +{ + kfree(data); +} + static struct io_rsrc_data *io_rsrc_data_alloc(struct io_ring_ctx *ctx, rsrc_put_fn *do_put) { @@ -7147,7 +7152,7 @@ static void __io_sqe_files_unregister(struct io_ring_ctx *ctx) } #endif io_free_file_tables(&ctx->file_table, ctx->nr_user_files); - kfree(ctx->file_data); + io_rsrc_data_free(ctx->file_data); ctx->file_data = NULL; ctx->nr_user_files = 0; } @@ -7624,7 +7629,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, io_free_file_tables(&ctx->file_table, nr_args); ctx->nr_user_files = 0; out_free: - kfree(ctx->file_data); + io_rsrc_data_free(ctx->file_data); ctx->file_data = NULL; return ret; } -- 2.31.1