aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Shishkin <edward@namesys.com>2005-05-01 11:59:09 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:09 -0400
commit74f9f974a64dc3de554aa1977bf108334436e47b (patch)
tree0fe911ce4f0b5003e334c6492c5ee7d70ac0dfbd
parent439bd3708792e31057db424d1165473122d531a3 (diff)
[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>
-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,
2306 if( !IS_ERR( journal -> j_dev_file ) ) { 2306 if( !IS_ERR( journal -> j_dev_file ) ) {
2307 struct inode *jdev_inode = journal->j_dev_file->f_mapping->host; 2307 struct inode *jdev_inode = journal->j_dev_file->f_mapping->host;
2308 if( !S_ISBLK( jdev_inode -> i_mode ) ) { 2308 if( !S_ISBLK( jdev_inode -> i_mode ) ) {
2309 reiserfs_warning (super, "journal_init_dev: '%s' is " 2309 reiserfs_warning(super, "journal_init_dev: '%s' is "
2310 "not a block device", jdev_name ); 2310 "not a block device", jdev_name );
2311 result = -ENOTBLK; 2311 result = -ENOTBLK;
2312 release_journal_dev( super, journal );
2312 } else { 2313 } else {
2313 /* ok */ 2314 /* ok */
2314 journal->j_dev_bd = I_BDEV(jdev_inode); 2315 journal->j_dev_bd = I_BDEV(jdev_inode);
2315 set_blocksize(journal->j_dev_bd, super->s_blocksize); 2316 set_blocksize(journal->j_dev_bd, super->s_blocksize);
2317 reiserfs_info(super, "journal_init_dev: journal device: %s\n",
2318 bdevname(journal->j_dev_bd, b));
2316 } 2319 }
2317 } else { 2320 } else {
2318 result = PTR_ERR( journal -> j_dev_file ); 2321 result = PTR_ERR( journal -> j_dev_file );
@@ -2321,11 +2324,6 @@ static int journal_init_dev( struct super_block *super,
2321 "journal_init_dev: Cannot open '%s': %i", 2324 "journal_init_dev: Cannot open '%s': %i",
2322 jdev_name, result ); 2325 jdev_name, result );
2323 } 2326 }
2324 if( result != 0 ) {
2325 release_journal_dev( super, journal );
2326 }
2327 reiserfs_info(super, "journal_init_dev: journal device: %s\n",
2328 bdevname(journal->j_dev_bd, b));
2329 return result; 2327 return result;
2330} 2328}
2331 2329