linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] z3fold: fix memory leak
@ 2018-04-04  0:51 Xidong Wang
  2018-04-04 22:20 ` Andrew Morton
  2018-04-05 14:57 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Xidong Wang @ 2018-04-04  0:51 UTC (permalink / raw)
  To: Andrew Morton, Vitaly Wool, Mike Rapoport
  Cc: wangxidong_97, linux-mm, linux-kernel

In function z3fold_create_pool(), the memory allocated by
__alloc_percpu() is not released on the error path that pool->compact_wq
, which holds the return value of create_singlethread_workqueue(), is NULL.
This will result in a memory leak bug.

Signed-off-by: Xidong Wang <wangxidong_97@163.com>
---
 mm/z3fold.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/z3fold.c b/mm/z3fold.c
index d589d31..b987cc5 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -490,6 +490,7 @@ static struct z3fold_pool *z3fold_create_pool(const char *name, gfp_t gfp,
 out_wq:
 	destroy_workqueue(pool->compact_wq);
 out:
+	free_percpu(pool->unbuddied);
 	kfree(pool);
 	return NULL;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-05 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-04  0:51 [PATCH 1/1] z3fold: fix memory leak Xidong Wang
2018-04-04 22:20 ` Andrew Morton
2018-04-04 22:23   ` Andrew Morton
2018-04-05 14:57 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).