mm/z3fold: fix potential memory leak in z3fold_destroy_pool()
authorMiaohe Lin <linmiaohe@huawei.com>
Thu, 1 Jul 2021 01:50:36 +0000 (18:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 1 Jul 2021 03:47:28 +0000 (20:47 -0700)
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 <linmiaohe@huawei.com>
Reviewed-by: Vitaly Wool <vitaly.wool@konsulko.com>
Cc: Hillf Danton <hdanton@sina.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/z3fold.c

index 9a42172a1bcd4e4ed6374543169ec6d4a47cd52f..f34130ff093d51106de1aaf442c5f091c4affae8 100644 (file)
@@ -1046,6 +1046,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);
 }