From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: abuchbinder@google.com, Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 5/5] resize2fs: sanity check the free blocks and inode counts
Date: Sun, 23 Jul 2017 00:50:35 -0400 [thread overview]
Message-ID: <20170723045035.26019-5-tytso@mit.edu> (raw)
In-Reply-To: <20170723045035.26019-1-tytso@mit.edu>
If the free block or free inodes count are larger than the number of
blocks or inodes in the system, request that the file system be
checked. Otherwise it's possible for calcuate_minimum_resize_size()
to hang in an infinite loop.
This problem was found using American Fuzzy Lop.
Reported-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
resize/main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/resize/main.c b/resize/main.c
index 396391b68..ab7375c17 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -440,6 +440,10 @@ int main (int argc, char ** argv)
!print_min_size)
checkit = 1;
+ if ((fs->super->s_free_blocks_count > fs->super->s_blocks_count) ||
+ (fs->super->s_free_inodes_count > fs->super->s_inodes_count))
+ checkit = 1;
+
if (checkit) {
fprintf(stderr,
_("Please run 'e2fsck -f %s' first.\n\n"),
--
2.11.0.rc0.7.gbe5a750
prev parent reply other threads:[~2017-07-23 4:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-23 4:50 [PATCH 1/5] e2fsck: quiet some harmless bitmap warnings Theodore Ts'o
2017-07-23 4:50 ` [PATCH 2/5] e2fsck: don't restart after a critical metadata collision in e2fsck -n mode Theodore Ts'o
2017-07-23 4:50 ` [PATCH 3/5] libext2fs: add stricter checks on the inode size in ext2fs_open2() Theodore Ts'o
2017-07-23 4:50 ` [PATCH 4/5] debugfs: add sanity checking to the string_to_inode() utility function Theodore Ts'o
2017-07-23 4:50 ` Theodore Ts'o [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=20170723045035.26019-5-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=abuchbinder@google.com \
--cc=linux-ext4@vger.kernel.org \
/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).