public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Xi Wang <xi.wang@gmail.com>
To: Andreas Dilger <aedilger@gmail.com>
Cc: Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: avoid oversized shift in ext4_fill_flex_info()
Date: Mon, 26 Dec 2011 21:26:22 -0500	[thread overview]
Message-ID: <3C498AE4-D26A-41AD-A862-EE1C80290C7B@gmail.com> (raw)
In-Reply-To: <C0DF217A-64C8-49E3-B979-652DB2C362C3@gmail.com>

On Dec 26, 2011, at 2:20 AM, Andreas Dilger wrote:
> While this is true in theory, it is not possible to have 2^32 groups per flex group. This would mean 2^32 block bitmaps and inode bitmaps in a single group, which is impossible. 

This patch is based on commit 503358ae "ext4: avoid divide by zero
when trying to mount a corrupted file system", as I quote: "If
s_log_groups_per_flex is greater than 31, then groups_per_flex will
will overflow and cause a divide by zero error."  The intent is to
avoid oversized shift in that commit, because the behavior is
undefined in C and may vary on different architectures.

My understanding is that sbi->s_es->s_log_groups_per_flex needs a
sanity check if it is read from a malicious or corrupted filesystem
in ext4_fill_flex_info(), which is called from ext4_fill_super().

Did I miss anything?

- xi

      reply	other threads:[~2011-12-27  2:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-26  6:36 [PATCH] ext4: avoid oversized shift in ext4_fill_flex_info() Xi Wang
2011-12-26  7:20 ` Andreas Dilger
2011-12-27  2:26   ` Xi Wang [this message]

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=3C498AE4-D26A-41AD-A862-EE1C80290C7B@gmail.com \
    --to=xi.wang@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=aedilger@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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