diff --git a/fs/io_uring.c b/fs/io_uring.c index cfcdea67a0e37f70d0500d7a7b819e59f6654624..1d817374131097c833046ad2ce81295604e5cc2a 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8475,8 +8475,6 @@ static void io_ring_ctx_free(struct io_ring_ctx *ctx) if (ctx->sqo_task) { put_task_struct(ctx->sqo_task); ctx->sqo_task = NULL; - mmdrop(ctx->mm_account); - ctx->mm_account = NULL; } #ifdef CONFIG_BLK_CGROUP @@ -8497,6 +8495,11 @@ static void io_ring_ctx_free(struct io_ring_ctx *ctx) } #endif + if (ctx->mm_account) { + mmdrop(ctx->mm_account); + ctx->mm_account = NULL; + } + io_mem_free(ctx->rings); io_mem_free(ctx->sq_sqes);