summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorFrank Sorenson <fsorenso@redhat.com>2014-07-04 15:31:50 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-07-04 23:59:44 -0400
commit4b59352edb5ce783ba578d708de1fda981acfec6 (patch)
treea3a06f39a4683457ed0dcfe856e694836da88eed /misc
parent2f8d0251967360ee216c339ee76f3ceab3aadb4d (diff)
downloade2fsprogs-4b59352edb5ce783ba578d708de1fda981acfec6.tar.gz
mke2fs: prevent creation of filesystem with unsupported revision
It's a bit strange to accept revision levels higher than the code creating the filesystem can understand, so don't allow it. At least the kernel will mount the fs readonly if it's too high, but no other utility will touch it, so you can't fix the error. Just reject anything > EXT2_MAX_SUPP_REV at mkfs time. Signed-off-by: Frank Sorenson <fsorenso@redhat.com> [sandeen@redhat.com: Add more verbose commit log] Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r--misc/mke2fs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index da4ddace..883b8f2c 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1659,6 +1659,11 @@ profile_error:
_("bad revision level - %s"), optarg);
exit(1);
}
+ if (r_opt > EXT2_MAX_SUPP_REV) {
+ com_err(program_name, EXT2_ET_REV_TOO_HIGH,
+ _("while trying to create revision %d"), r_opt);
+ exit(1);
+ }
fs_param.s_rev_level = r_opt;
break;
case 's': /* deprecated */