mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	Nitin Gupta <ngupta@vflare.org>,
	devel@driverdev.osuosl.org
Subject: [PATCH] staging: zcache: fix memory leak
Date: Thu, 10 Feb 2011 21:00:39 +0300	[thread overview]
Message-ID: <1297360839-21602-1-git-send-email-segoon@openwall.com> (raw)

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


             reply	other threads:[~2011-02-10 18:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 18:00 Vasiliy Kulikov [this message]
2011-02-10 18:24 ` Dan Magenheimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297360839-21602-1-git-send-email-segoon@openwall.com \
    --to=segoon@openwall.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ngupta@vflare.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®