2006-10-11 20:17:07

by Dave Kleikamp

[permalink] [raw]
Subject: [PATCH] null dereference in fs/jbd2/journal.c

This is Eric Sesterhenn's jbd patch applied to jbd2.
Commit: 41716c7c21b15e7ecf14f0caf1eef3980707fb74

His words:

Since commit d1807793e1e7e502e3dc047115e9dbc3b50e4534 we dereference a NULL
pointer. Coverity id #1432. We set journal to NULL, and use it directly
afterwards.

Signed-off-by: Dave Kleikamp <[email protected]>

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 10db92c..c60f378 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -725,6 +725,7 @@ journal_t * jbd2_journal_init_dev(struct
__FUNCTION__);
kfree(journal);
journal = NULL;
+ goto out;
}
journal->j_dev = bdev;
journal->j_fs_dev = fs_dev;
@@ -735,7 +736,7 @@ journal_t * jbd2_journal_init_dev(struct
J_ASSERT(bh != NULL);
journal->j_sb_buffer = bh;
journal->j_superblock = (journal_superblock_t *)bh->b_data;
-
+out:
return journal;
}


--
David Kleikamp
IBM Linux Technology Center