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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac8f92701003210701j5926f2c4v843e36bc602a0444@mail.gmail.com>
Date:	Sun, 21 Mar 2010 22:01:06 +0800
From:	jing zhang <zj.barak@...il.com>
To:	linux-ext4 <linux-ext4@...r.kernel.org>
Cc:	"Theodore Ts'o" <tytso@....edu>, Andreas Dilger <adilger@....com>,
	Dave Kleikamp <shaggy@...ux.vnet.ibm.com>
Subject: [PATCH] ext4: memory leakage in ext4_mb_init()

From: Jing Zhang <zj.barak@...il.com>

Date: Sun Mar 21 21:59:35     2010

Cc: Theodore Ts'o <tytso@....edu>
Cc: Andreas Dilger <adilger@....com>
Cc: Dave Kleikamp <shaggy@...ux.vnet.ibm.com>
Signed-off-by: Jing Zhang <zj.barak@...il.com>

---

--- linux-2.6.32/fs/ext4/mballoc.c	2009-12-03 11:51:22.000000000 +0800
+++ ext4_mm_leak/mballoc3.c	2010-03-21 21:37:18.000000000 +0800
@@ -2360,6 +2360,24 @@ err_freesgi:
 	return -ENOMEM;
 }

+static void ext4_mb_destroy_backend(struct super_block *sb)
+{
+	ext4_group_t ngroups = ext4_get_groups_count(sb);
+	ext4_group_t i;
+	struct ext4_sb_info *sbi = EXT4_SB(sb);
+	int j;
+	int num_meta_group_infos = (ngroups + EXT4_DESC_PER_BLOCK(sb) -1)
+					>> EXT4_DESC_PER_BLOCK_BITS(sb);
+	for (i = 0; i < ngroups; i++)
+		kfree(ext4_get_group_info(sb, i));
+
+	for (j = 0; j < num_meta_group_infos; j++)
+		kfree(sbi->s_group_info[j]);
+
+	kfree(sbi->s_group_info);
+	iput(sbi->s_buddy_cache);
+}
+
 int ext4_mb_init(struct super_block *sb, int needs_recovery)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -2419,6 +2437,7 @@ int ext4_mb_init(struct super_block *sb,
 	if (sbi->s_locality_groups == NULL) {
 		kfree(sbi->s_mb_offsets);
 		kfree(sbi->s_mb_maxs);
+		ext4_mb_destroy_backend(sb);
 		return -ENOMEM;
 	}
 	for_each_possible_cpu(i) {
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ