diff mbox

e2fsprogs: check for bogus new_size in resize2fs

Message ID 48EFD957.3000406@redhat.com
State Accepted, archived
Headers show

Commit Message

Eric Sandeen Oct. 10, 2008, 10:38 p.m. UTC
Resolves RH Bug 465984 - resize2fs doesn't recognize bogus argument, ending in infinite loop

If we don't check for new_size == 0, bogus values send resize2fs into
a tailspin:

resize2fs 1.41.0 (10-Jul-2008)
Illegal block number passed to ext2fs_test_block_bitmap #1 for block bitmap for
...the same message repeated zillion times...

Probably should see where that loop is, but at any rate we should
error-check parse_num_blocks.

Thanks to Petr Muller for reporting this.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox


Index: e2fsprogs/resize/main.c
--- e2fsprogs.orig/resize/main.c
+++ e2fsprogs/resize/main.c
@@ -376,6 +376,11 @@  int main (int argc, char ** argv)
 	else if (new_size_str) {
 		new_size = parse_num_blocks(new_size_str,
+		if (new_size == 0) {
+			com_err(program_name, 0,
+				_("Invalid new size: %s\n"), new_size_str);
+			exit(1);
+		}
 	} else {
 		new_size = max_size;
 		/* Round down to an even multiple of a pagesize */