linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: George Spelvin <linux@horizon.com>, Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 1/6] mke2fs: fix crash when parsing "-E resize=NNN" with "-O 64bit"
Date: Sat, 29 Dec 2012 03:55:23 -0500	[thread overview]
Message-ID: <1356771328-18196-2-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1356771328-18196-1-git-send-email-tytso@mit.edu>

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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 7ec8cc2..0f9a299 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -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) {
-- 
1.7.12.rc0.22.gcdd159b


  reply	other threads:[~2012-12-29  8:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-29  8:55 [PATCH RFC 0/6] add full off-line resize2fs support for flex_bg file systems Theodore Ts'o
2012-12-29  8:55 ` Theodore Ts'o [this message]
2012-12-29  8:55 ` [PATCH 2/6] resize2fs: reserve fs metadata blocks first in blocks_to_move() Theodore Ts'o
2012-12-29  8:55 ` [PATCH 3/6] resize2fs: reserve all metadata blocks for flex_bg file systems Theodore Ts'o
2012-12-29  8:55 ` [PATCH 4/6] resize2fs: handle bg descriptors which overlap with other bg's metadata Theodore Ts'o
2012-12-29  8:55 ` [PATCH 5/6] resize2fs: allow resizing flex_bg && !resize_inode file systems Theodore Ts'o
2012-12-29  8:55 ` [PATCH 6/6] resize2fs: create optimized flex_bg block groups Theodore Ts'o
2012-12-29  9:32 ` [PATCH RFC 0/6] add full off-line resize2fs support for flex_bg file systems Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1356771328-18196-2-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux@horizon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).