From: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
To: Theodore Tso <tytso@mit.edu>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: Vegard Nossum <vegard.nossum@gmail.com>, Jan Kara <jack@ucw.cz>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-ext4@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>, Ingo Molnar <mingo@elte.hu>,
Pekka Enberg <penberg@cs.helsinki.fi>,
linux-kernel@vger.kernel.org,
sugita <yumiko.sugita.yf@hitachi.com>,
Satoshi OSHIMA <satoshi.oshima.fk@hitachi.com>
Subject: [PATCH 2/2] ext4: fix a bug accessing freed memory in ext4_abort
Date: Mon, 27 Oct 2008 16:37:09 +0900 [thread overview]
Message-ID: <49056FA5.7070202@hitachi.com> (raw)
In-Reply-To: <49056D29.2010700@hitachi.com>
Vegard Nossum reported a bug which accesses freed memory. When
journal has been aborted, ext4_put_super() calls ext4_abort() after
freeing the journal_t object, and then ext4_abort() accesses it.
This patch fix it.
Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
---
fs/ext4/super.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Index: linux-2.6.28-rc2/fs/ext4/super.c
===================================================================
--- linux-2.6.28-rc2.orig/fs/ext4/super.c
+++ linux-2.6.28-rc2/fs/ext4/super.c
@@ -333,7 +333,8 @@ void ext4_abort(struct super_block *sb,
EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
sb->s_flags |= MS_RDONLY;
EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT;
- jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO);
+ if (EXT4_SB(sb)->s_journal)
+ jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO);
}
void ext4_warning(struct super_block *sb, const char *function,
@@ -442,14 +443,16 @@ static void ext4_put_super(struct super_
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_super_block *es = sbi->s_es;
- int i;
+ int i, err;
ext4_mb_release(sb);
ext4_ext_release(sb);
ext4_xattr_put_super(sb);
- if (jbd2_journal_destroy(sbi->s_journal) < 0)
- ext4_abort(sb, __func__, "Couldn't clean up the journal");
+ err = jbd2_journal_destroy(sbi->s_journal);
sbi->s_journal = NULL;
+ if (err < 0)
+ ext4_abort(sb, __func__, "Couldn't clean up the journal");
+
if (!(sb->s_flags & MS_RDONLY)) {
EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
es->s_state = cpu_to_le16(sbi->s_mount_state);
next prev parent reply other threads:[~2008-10-27 7:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-25 11:22 v2.6.28-rc1: Regression in ext3/jbd Vegard Nossum
2008-10-27 7:26 ` [PATCH 1/2] ext3: fix a bug accessing freed memory in ext3_abort Hidehiro Kawai
2008-10-27 7:37 ` Hidehiro Kawai [this message]
2008-10-27 8:11 ` [PATCH 2/2] ext4: fix a bug accessing freed memory in ext4_abort Jan Kara
2008-10-27 10:43 ` Ingo Molnar
2008-10-27 11:44 ` [PATCH 1/2 take 2] ext3: fix a bug accessing freed memory in ext3_abort Hidehiro Kawai
2008-10-27 11:50 ` [PATCH 2/2 take 2] ext4: fix a bug accessing freed memory in ext4_abort Hidehiro Kawai
2008-10-27 18:05 ` Theodore Tso
2008-10-27 8:11 ` [PATCH 1/2] ext3: fix a bug accessing freed memory in ext3_abort Jan Kara
2008-10-27 7:31 ` Hidehiro Kawai
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=49056FA5.7070202@hitachi.com \
--to=hidehiro.kawai.ez@hitachi.com \
--cc=akpm@linux-foundation.org \
--cc=jack@ucw.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=penberg@cs.helsinki.fi \
--cc=rjw@sisk.pl \
--cc=satoshi.oshima.fk@hitachi.com \
--cc=sfr@canb.auug.org.au \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=vegard.nossum@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yumiko.sugita.yf@hitachi.com \
/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.