From: Miaohe Lin Date: Thu, 1 Jul 2021 01:50:36 +0000 (-0700) Subject: mm/z3fold: fix potential memory leak in z3fold_destroy_pool() X-Git-Tag: v5.4.132~9 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=49496327c2907eed640684f7058ca8411b67a118;p=users%2Fdwmw2%2Flinux.git mm/z3fold: fix potential memory leak in z3fold_destroy_pool() [ Upstream commit dac0d1cfda56472378d330b1b76b9973557a7b1d ] There is a memory leak in z3fold_destroy_pool() as it forgets to free_percpu pool->unbuddied. Call free_percpu for pool->unbuddied to fix this issue. Link: https://lkml.kernel.org/r/20210619093151.1492174-6-linmiaohe@huawei.com Fixes: d30561c56f41 ("z3fold: use per-cpu unbuddied lists") Signed-off-by: Miaohe Lin Reviewed-by: Vitaly Wool Cc: Hillf Danton Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- diff --git a/mm/z3fold.c b/mm/z3fold.c index 6d3d3f698ebb9..e97143713021e 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -839,6 +839,7 @@ static void z3fold_destroy_pool(struct z3fold_pool *pool) destroy_workqueue(pool->compact_wq); destroy_workqueue(pool->release_wq); z3fold_unregister_migration(pool); + free_percpu(pool->unbuddied); kfree(pool); }