From: Jim Keniston <jkenisto@us.ibm.com>
To: tytso@mit.edu, linux-ext4@vger.kernel.org
Cc: ddstreet@us.ibm.com, mcao@us.ibm.com, alexfr@il.ibm.com
Subject: [PATCH] e2fsprogs: e2fsck_handle_read_error - pass along negative count
Date: Mon, 06 Aug 2012 13:05:53 -0700 [thread overview]
Message-ID: <20120806200553.9312.52751.stgit@localhost.localdomain> (raw)
When passed a negative count (indicating a byte count rather than
a block count) e2fsck_handle_read_error() treats the data as a full
block, causing unix_write_blk64() (which can handle negative counts
just fine) to try to write too much. Given a faulty block device,
this resulted in a SEGV when unix_write_blk64() read past the bottom
of the stack copying the data to cache. (check_backup_super_block ->
unix_read_blk64 -> raw_read_blk -> e2fsck_handle_read_error)
Signed-off-by: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Dan Streetman <ddstreet@us.ibm.com>
Reviewed-by: Mingming Cao <mcao@us.ibm.com>
Reported-by: Alex Friedman <alexfr@il.ibm.com>
---
e2fsck/ehandler.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/e2fsck/ehandler.c b/e2fsck/ehandler.c
index 6eecf33..6dddf9c 100644
--- a/e2fsck/ehandler.c
+++ b/e2fsck/ehandler.c
@@ -60,7 +60,7 @@ static errcode_t e2fsck_handle_read_error(io_channel channel,
preenhalt(ctx);
if (ask(ctx, _("Ignore error"), 1)) {
if (ask(ctx, _("Force rewrite"), 1))
- io_channel_write_blk64(channel, block, 1, data);
+ io_channel_write_blk64(channel, block, count, data);
return 0;
}
next reply other threads:[~2012-08-06 20:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-06 20:05 Jim Keniston [this message]
2012-08-06 22:55 ` [PATCH] e2fsprogs: e2fsck_handle_read_error - pass along negative count 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=20120806200553.9312.52751.stgit@localhost.localdomain \
--to=jkenisto@us.ibm.com \
--cc=alexfr@il.ibm.com \
--cc=ddstreet@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=mcao@us.ibm.com \
--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;
as well as URLs for NNTP newsgroup(s).