mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: zcache: fix memory leak
@ 2011-02-10 18:00 Vasiliy Kulikov
  2011-02-10 18:24 ` Dan Magenheimer
  0 siblings, 1 reply; 2+ messages in thread
From: Vasiliy Kulikov @ 2011-02-10 18:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Dan Magenheimer, Nitin Gupta, devel

obj is not freed if __get_free_page() failed.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
---
 Compile tested only.

 drivers/staging/zcache/zcache.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/zcache/zcache.c b/drivers/staging/zcache/zcache.c
index 61be849..b8a2b30 100644
--- a/drivers/staging/zcache/zcache.c
+++ b/drivers/staging/zcache/zcache.c
@@ -790,6 +790,7 @@ static int zcache_do_preload(struct tmem_pool *pool)
 	page = (void *)__get_free_page(ZCACHE_GFP_MASK);
 	if (unlikely(page == NULL)) {
 		zcache_failed_get_free_pages++;
+		kmem_cache_free(zcache_obj_cache, obj);
 		goto unlock_out;
 	}
 	preempt_disable();
-- 
1.7.0.4


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

end of thread, other threads:[~2011-02-10 18:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 18:00 [PATCH] staging: zcache: fix memory leak Vasiliy Kulikov
2011-02-10 18:24 ` Dan Magenheimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®