]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: fix crash when parsing "-E resize=NNN" with "-O 64bit"
authorTheodore Ts'o <tytso@mit.edu>
Fri, 28 Dec 2012 23:26:12 +0000 (18:26 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 28 Dec 2012 23:26:12 +0000 (18:26 -0500)
If the 64-bit file system feature is enabled, then mke2fs would crash
due to a divide-by-zero error caused by s_desc_size not being
initialized yet.

Reported-by: George Spelvin <linux@horizon.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/mke2fs.c

index 7ec8cc2f3cef6c2602030f03269bf390fb9d1d5e..0f9a299ff664635925694dfa4e39b993574f62d0 100644 (file)
@@ -1873,6 +1873,14 @@ profile_error:
 
        blocksize = EXT2_BLOCK_SIZE(&fs_param);
 
+       /*
+        * Initialize s_desc_size so that the parse_extended_opts()
+        * can correctly handle "-E resize=NNN" if the 64-bit option
+        * is set.
+        */
+       if (fs_param.s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
+               fs_param.s_desc_size = EXT2_MIN_DESC_SIZE_64BIT;
+
        /* This check should happen beyond the last assignment to blocksize */
        if (blocksize > sys_page_size) {
                if (!force) {