summaryrefslogtreecommitdiff
path: root/fs/reiserfs/journal.c
diff options
context:
space:
mode:
authorEdward Shishkin <edward@namesys.com>2005-05-01 19:59:09 +0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 19:59:09 +0400
commit74f9f974a64dc3de554aa1977bf108334436e47b (patch)
tree0fe911ce4f0b5003e334c6492c5ee7d70ac0dfbd /fs/reiserfs/journal.c
parent439bd3708792e31057db424d1165473122d531a3 (diff)
downloadlinux-74f9f974a64dc3de554aa1977bf108334436e47b.tar.xz
[PATCH] reiserfs: journal_init fix
This fixes segmentation fault when specifying bad journal device via a mount option. Don't pass a zero pointer to bdevname() if filp_open() returns error. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/reiserfs/journal.c')
-rw-r--r--fs/reiserfs/journal.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index c9ad3a7849f4..b16d65acb550 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2306,13 +2306,16 @@ static int journal_init_dev( struct super_block *super,
if( !IS_ERR( journal -> j_dev_file ) ) {
struct inode *jdev_inode = journal->j_dev_file->f_mapping->host;
if( !S_ISBLK( jdev_inode -> i_mode ) ) {
- reiserfs_warning (super, "journal_init_dev: '%s' is "
- "not a block device", jdev_name );
+ reiserfs_warning(super, "journal_init_dev: '%s' is "
+ "not a block device", jdev_name );
result = -ENOTBLK;
+ release_journal_dev( super, journal );
} else {
/* ok */
journal->j_dev_bd = I_BDEV(jdev_inode);
set_blocksize(journal->j_dev_bd, super->s_blocksize);
+ reiserfs_info(super, "journal_init_dev: journal device: %s\n",
+ bdevname(journal->j_dev_bd, b));
}
} else {
result = PTR_ERR( journal -> j_dev_file );
@@ -2321,11 +2324,6 @@ static int journal_init_dev( struct super_block *super,
"journal_init_dev: Cannot open '%s': %i",
jdev_name, result );
}
- if( result != 0 ) {
- release_journal_dev( super, journal );
- }
- reiserfs_info(super, "journal_init_dev: journal device: %s\n",
- bdevname(journal->j_dev_bd, b));
return result;
}