From: Eric Sandeen <sandeen@redhat.com>
To: linux-kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
ext4 development <linux-ext4@vger.kernel.org>
Subject: [RESEND][PATCH] dir_index: error out instead of BUG on corrupt hash dir limit
Date: Fri, 31 Aug 2007 21:48:43 -0500 [thread overview]
Message-ID: <46D8D30B.6090703@redhat.com> (raw)
(resend, this one got lost? Got an acked-by from Andreas
last go-round)
(Andrew, Ted, should I be splitting out ext3 and ext4 patches and
sending separately...?)
Thanks,
-Eric
----------
A corrupt ondisk hash dir limit will trip an assert in dx_probe,
which calls BUG(). Instead, we can just issue the warning and
fail dx_probe like the other 3 tests just before it. Thanks
to aviro for suggesting this... Tested with a hand-crafted
corrupt ext3 image, issues:
EXT3-fs warning (device loop0): dx_probe: Corrupt limit in dir inode 14337
vs. previous:
Assertion failure in dx_probe() at fs/ext3/namei.c:383: "dx_get_limit(entries) == dx_root_limit(dir, root->info.info_length)"
------------[ cut here ]------------
kernel BUG at fs/ext3/namei.c:383!
...
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Index: linux-2.6.22-rc4/fs/ext3/namei.c
===================================================================
--- linux-2.6.22-rc4.orig/fs/ext3/namei.c
+++ linux-2.6.22-rc4/fs/ext3/namei.c
@@ -379,8 +379,16 @@ dx_probe(struct dentry *dentry, struct i
entries = (struct dx_entry *) (((char *)&root->info) +
root->info.info_length);
- assert(dx_get_limit(entries) == dx_root_limit(dir,
- root->info.info_length));
+
+ if (dx_get_limit(entries) != dx_root_limit(dir,
+ root->info.info_length)) {
+ ext3_warning(dir->i_sb, __FUNCTION__,
+ "Corrupt limit in dir inode %ld\n", dir->i_ino);
+ brelse(bh);
+ *err = ERR_BAD_DX_DIR;
+ goto fail;
+ }
+
dxtrace (printk("Look up %x", hash));
while (1)
{
Index: linux-2.6.22-rc4/fs/ext4/namei.c
===================================================================
--- linux-2.6.22-rc4.orig/fs/ext4/namei.c
+++ linux-2.6.22-rc4/fs/ext4/namei.c
@@ -379,8 +379,16 @@ dx_probe(struct dentry *dentry, struct i
entries = (struct dx_entry *) (((char *)&root->info) +
root->info.info_length);
- assert(dx_get_limit(entries) == dx_root_limit(dir,
- root->info.info_length));
+
+ if (dx_get_limit(entries) != dx_root_limit(dir,
+ root->info.info_length)) {
+ ext4_warning(dir->i_sb, __FUNCTION__,
+ "Corrupt limit in dir inode %ld\n", dir->i_ino);
+ brelse(bh);
+ *err = ERR_BAD_DX_DIR;
+ goto fail;
+ }
+
dxtrace (printk("Look up %x", hash));
while (1)
{
next reply other threads:[~2007-09-01 2:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-01 2:48 Eric Sandeen [this message]
2007-09-09 13:19 ` [RESEND][PATCH] dir_index: error out instead of BUG on corrupt hash dir limit Duane Griffin
2007-09-10 14:59 ` Eric Sandeen
2007-09-10 22:06 ` Duane Griffin
2007-09-10 22:41 ` [PATCH V2] dir_index: error out instead of BUG on corrupt dx dirs Eric Sandeen
2007-09-11 1:35 ` Duane Griffin
2007-09-11 1:42 ` [PATCH V3] " Eric Sandeen
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=46D8D30B.6090703@redhat.com \
--to=sandeen@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@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).