lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL1ERfPzB=CvKJ6kAq2YYTkkg-EgSOWRyfSFWkvKp8ZdQkCDxA@mail.gmail.com>
Date:	Fri, 23 Aug 2013 19:03:37 +0800
From:	Weijie Yang <weijie.yang.kh@...il.com>
To:	Minchan Kim <minchan@...nel.org>, Bob Liu <bob.liu@...cle.com>,
	sjenning@...ux.vnet.ibm.com
Cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	weijie.yang@...sung.com
Subject: [PATCH 1/4] zswap bugfix: memory leaks when re-swapon

zswap_tree is not freed when swapoff, and it got re-kzalloc in swapon,
memory leak occurs.
Add check statement in zswap_frontswap_init so that zswap_tree is
inited only once.

---
 mm/zswap.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/mm/zswap.c b/mm/zswap.c
index deda2b6..1cf1c07 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -826,6 +826,11 @@ static void zswap_frontswap_init(unsigned type)
 {
 	struct zswap_tree *tree;

+	if (zswap_trees[type]) {
+		BUG_ON(zswap_trees[type]->rbroot != RB_ROOT);  /* invalidate_area set it */
+		return;
+	}
+
 	tree = kzalloc(sizeof(struct zswap_tree), GFP_KERNEL);
 	if (!tree)
 		goto err;
-- 
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ