All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalpak Shah <kalpak@clusterfs.com>
To: TheodoreTso <tytso@mit.edu>
Cc: linux-ext4 <linux-ext4@vger.kernel.org>,
	Andreas Dilger <adilger@clusterfs.com>
Subject: [e2fsprogs] Bug in salvage_directory
Date: Mon, 09 Jul 2007 15:02:02 +0530	[thread overview]
Message-ID: <1183973522.3889.10.camel@garfield.linsyssoft.com> (raw)

Hi Ted,

Recently, one of our customers found this message in pass2 of e2fsck while doing some regression testing:
"Entry '4, 0x695a, 0x81ff, 0x0040, 0x8320, 0xa192, 0x0021' in ??? (136554) has
rec_len of 14200, should be 26908."

Both the displayed rec_len and the "should be" value are bogus. The reason is that salvage_directory sets a offset beyond blocksize leading to bogus messages.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>

Index: e2fsprogs-1.39/e2fsck/pass2.c
===================================================================
--- e2fsprogs-1.39.orig/e2fsck/pass2.c
+++ e2fsprogs-1.39/e2fsck/pass2.c
@@ -690,7 +690,10 @@ static void salvage_directory(ext2_filsy
 	 */
 	if (prev && dirent->rec_len && (dirent->rec_len % 4) == 0) {
 		prev->rec_len += dirent->rec_len;
-		*offset += dirent->rec_len;
+		if (*offset + dirent->rec_len <= fs->blocksize)
+			*offset += dirent->rec_len;
+		else
+			*offset = fs->blocksize;
 		return;
 	}
 	/*


Thanks,
Kalpak.

             reply	other threads:[~2007-07-09  9:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09  9:32 Kalpak Shah [this message]
2007-07-09 16:50 ` [e2fsprogs] Bug in salvage_directory Theodore Tso
2007-07-09 17:52   ` Kalpak Shah
2007-07-09 18:29     ` Theodore Tso
2007-07-09 19:17       ` Andreas Dilger
2007-07-09 20:20         ` Theodore Tso
     [not found]     ` <20070709230234.GE2343@thunk.org>
2007-07-10  6:47       ` Kalpak Shah

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=1183973522.3889.10.camel@garfield.linsyssoft.com \
    --to=kalpak@clusterfs.com \
    --cc=adilger@clusterfs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.