[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4905A99F.8000605@hitachi.com>
Date: Mon, 27 Oct 2008 20:44:31 +0900
From: Hidehiro Kawai <hidehiro.kawai.ez@...achi.com>
To: Ingo Molnar <mingo@...e.hu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Theodore Tso <tytso@....edu>,
Vegard Nossum <vegard.nossum@...il.com>,
Jan Kara <jack@....cz>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Al Viro <viro@...iv.linux.org.uk>, linux-ext4@...r.kernel.org,
"Rafael J. Wysocki" <rjw@...k.pl>,
Pekka Enberg <penberg@...helsinki.fi>,
linux-kernel@...r.kernel.org,
sugita <yumiko.sugita.yf@...achi.com>,
Satoshi OSHIMA <satoshi.oshima.fk@...achi.com>
Subject: [PATCH 1/2 take 2] ext3: fix a bug accessing freed memory in
ext3_abort
Ingo Molnar wrote:
> * Hidehiro Kawai <hidehiro.kawai.ez@...achi.com> wrote:
>
>>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@...achi.com>
>
> could you please put the word "kmemcheck" into the commit log? ("found
> via kmemcheck" or so) We want to have an easily git-greppable track
> record of upstream kernel bugs that were found via kmemcheck. (and
> there's already a long list)
Ah, OK. I fixed the commit log.
Thanks,
Subject: [PATCH 1/2] ext3: fix a bug accessing freed memory in ext3_abort
Vegard Nossum reported a bug which accesses freed memory (found via
kmemcheck). When journal has been aborted, ext3_put_super() calls
ext3_abort() after freeing the journal_t object, and then ext3_abort()
accesses it. This patch fix it.
Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@...achi.com>
Acked-by: Jan Kara <jack@...e.cz>
---
fs/ext3/super.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
Index: linux-2.6.28-rc2/fs/ext3/super.c
===================================================================
--- linux-2.6.28-rc2.orig/fs/ext3/super.c
+++ linux-2.6.28-rc2/fs/ext3/super.c
@@ -281,7 +281,8 @@ void ext3_abort (struct super_block * sb
EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
sb->s_flags |= MS_RDONLY;
EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT;
- journal_abort(EXT3_SB(sb)->s_journal, -EIO);
+ if (EXT3_SB(sb)->s_journal)
+ journal_abort(EXT3_SB(sb)->s_journal, -EIO);
}
void ext3_warning (struct super_block * sb, const char * function,
@@ -390,11 +391,14 @@ static void ext3_put_super (struct super
{
struct ext3_sb_info *sbi = EXT3_SB(sb);
struct ext3_super_block *es = sbi->s_es;
- int i;
+ int i, err;
ext3_xattr_put_super(sb);
- if (journal_destroy(sbi->s_journal) < 0)
+ err = journal_destroy(sbi->s_journal);
+ sbi->s_journal = NULL;
+ if (err < 0)
ext3_abort(sb, __func__, "Couldn't clean up the journal");
+
if (!(sb->s_flags & MS_RDONLY)) {
EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
es->s_state = cpu_to_le16(sbi->s_mount_state);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists