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]
Date:	Thu,  5 Aug 2010 11:34:08 -0700
From:	Aditya Kali <adityakali@...gle.com>
To:	linux-ext4@...r.kernel.org
Cc:	tytso@....edu, Aditya Kali <adityakali@...gle.com>
Subject: [PATCH] Adding error check for ext4_mb_regular_allocator call.

If the bitmap block on disk is bad, the 'ext4_mb_load_buddy'
returns error. This error is returned to the caller
'ext4_mb_regular_allocator' and then to 'ext4_mb_new_blocks'. But
'ext4_mb_new_blocks' did not check for the return value of
'ext4_mb_regular_allocator' and would repeatedly try to load the
bitmap block. The fix simply catches the return value and exits out
of the 'repeat' loop after cleanup.

Signed-off-by: Aditya Kali <adityakali@...gle.com>
---
 fs/ext4/mballoc.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 0e83dfd..f8e99b9 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4322,7 +4322,14 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
 		ext4_mb_normalize_request(ac, ar);
 repeat:
 		/* allocate space in core */
-		ext4_mb_regular_allocator(ac);
+		*errp = ext4_mb_regular_allocator(ac);
+		if (*errp) {
+			ext4_discard_allocated_blocks(ac);
+			ac->ac_b_ex.fe_len = 0;
+			ar->len = 0;
+			ext4_mb_show_ac(ac);
+			goto out4;
+		}
 
 		/* as we've just preallocated more space than
 		 * user requested orinally, we store allocated
@@ -4363,6 +4370,7 @@ repeat:
 		ext4_mb_show_ac(ac);
 	}
 
+out4:
 	ext4_mb_release_context(ac);
 
 out2:
-- 
1.7.1

--
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