aboutsummaryrefslogtreecommitdiffstats
path: root/fs/affs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/affs/super.c')
-rw-r--r--fs/affs/super.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/fs/affs/super.c b/fs/affs/super.c
index b53e5d0ec65c..d2dc047cb479 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -113,7 +113,6 @@ static void destroy_inodecache(void)
113static const struct super_operations affs_sops = { 113static const struct super_operations affs_sops = {
114 .alloc_inode = affs_alloc_inode, 114 .alloc_inode = affs_alloc_inode,
115 .destroy_inode = affs_destroy_inode, 115 .destroy_inode = affs_destroy_inode,
116 .read_inode = affs_read_inode,
117 .write_inode = affs_write_inode, 116 .write_inode = affs_write_inode,
118 .put_inode = affs_put_inode, 117 .put_inode = affs_put_inode,
119 .drop_inode = affs_drop_inode, 118 .drop_inode = affs_drop_inode,
@@ -123,6 +122,7 @@ static const struct super_operations affs_sops = {
123 .write_super = affs_write_super, 122 .write_super = affs_write_super,
124 .statfs = affs_statfs, 123 .statfs = affs_statfs,
125 .remount_fs = affs_remount, 124 .remount_fs = affs_remount,
125 .show_options = generic_show_options,
126}; 126};
127 127
128enum { 128enum {
@@ -271,6 +271,9 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
271 unsigned long mount_flags; 271 unsigned long mount_flags;
272 int tmp_flags; /* fix remount prototype... */ 272 int tmp_flags; /* fix remount prototype... */
273 u8 sig[4]; 273 u8 sig[4];
274 int ret = -EINVAL;
275
276 save_mount_options(sb, data);
274 277
275 pr_debug("AFFS: read_super(%s)\n",data ? (const char *)data : "no options"); 278 pr_debug("AFFS: read_super(%s)\n",data ? (const char *)data : "no options");
276 279
@@ -444,7 +447,12 @@ got_root:
444 447
445 /* set up enough so that it can read an inode */ 448 /* set up enough so that it can read an inode */
446 449
447 root_inode = iget(sb, root_block); 450 root_inode = affs_iget(sb, root_block);
451 if (IS_ERR(root_inode)) {
452 ret = PTR_ERR(root_inode);
453 goto out_error_noinode;
454 }
455
448 sb->s_root = d_alloc_root(root_inode); 456 sb->s_root = d_alloc_root(root_inode);
449 if (!sb->s_root) { 457 if (!sb->s_root) {
450 printk(KERN_ERR "AFFS: Get root inode failed\n"); 458 printk(KERN_ERR "AFFS: Get root inode failed\n");
@@ -461,12 +469,13 @@ got_root:
461out_error: 469out_error:
462 if (root_inode) 470 if (root_inode)
463 iput(root_inode); 471 iput(root_inode);
472out_error_noinode:
464 kfree(sbi->s_bitmap); 473 kfree(sbi->s_bitmap);
465 affs_brelse(root_bh); 474 affs_brelse(root_bh);
466 kfree(sbi->s_prefix); 475 kfree(sbi->s_prefix);
467 kfree(sbi); 476 kfree(sbi);
468 sb->s_fs_info = NULL; 477 sb->s_fs_info = NULL;
469 return -EINVAL; 478 return ret;
470} 479}
471 480
472static int 481static int
@@ -481,14 +490,21 @@ affs_remount(struct super_block *sb, int *flags, char *data)
481 int root_block; 490 int root_block;
482 unsigned long mount_flags; 491 unsigned long mount_flags;
483 int res = 0; 492 int res = 0;
493 char *new_opts = kstrdup(data, GFP_KERNEL);
484 494
485 pr_debug("AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data); 495 pr_debug("AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data);
486 496
487 *flags |= MS_NODIRATIME; 497 *flags |= MS_NODIRATIME;
488 498
489 if (!parse_options(data,&uid,&gid,&mode,&reserved,&root_block, 499 if (!parse_options(data, &uid, &gid, &mode, &reserved, &root_block,
490 &blocksize,&sbi->s_prefix,sbi->s_volume,&mount_flags)) 500 &blocksize, &sbi->s_prefix, sbi->s_volume,
501 &mount_flags)) {
502 kfree(new_opts);
491 return -EINVAL; 503 return -EINVAL;
504 }
505 kfree(sb->s_options);
506 sb->s_options = new_opts;
507
492 sbi->s_flags = mount_flags; 508 sbi->s_flags = mount_flags;
493 sbi->s_mode = mode; 509 sbi->s_mode = mode;
494 sbi->s_uid = uid; 510 sbi->s_uid = uid;