Commit c99516ca authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  ext[34]: avoid i_nlink warnings triggered by drop_nlink/inc_nlink kludge in symlink()
  exofs: oops after late failure in mount
  devpts: fix double-free on mount failure
  ... and the same for gadgetfs
  functionfs: unfuck failure exits on mount
parents 72f31889 0ce8c010
...@@ -1037,7 +1037,6 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent) ...@@ -1037,7 +1037,6 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)
{ {
struct ffs_sb_fill_data *data = _data; struct ffs_sb_fill_data *data = _data;
struct inode *inode; struct inode *inode;
struct dentry *d;
struct ffs_data *ffs; struct ffs_data *ffs;
ENTER(); ENTER();
...@@ -1045,7 +1044,7 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent) ...@@ -1045,7 +1044,7 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)
/* Initialise data */ /* Initialise data */
ffs = ffs_data_new(); ffs = ffs_data_new();
if (unlikely(!ffs)) if (unlikely(!ffs))
goto enomem0; goto Enomem;
ffs->sb = sb; ffs->sb = sb;
ffs->dev_name = data->dev_name; ffs->dev_name = data->dev_name;
...@@ -1065,26 +1064,21 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent) ...@@ -1065,26 +1064,21 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)
&simple_dir_inode_operations, &simple_dir_inode_operations,
&data->perms); &data->perms);
if (unlikely(!inode)) if (unlikely(!inode))
goto enomem1; goto Enomem;
d = d_alloc_root(inode); sb->s_root = d_alloc_root(inode);
if (unlikely(!d)) if (unlikely(!sb->s_root)) {
goto enomem2; iput(inode);
sb->s_root = d; goto Enomem;
}
/* EP0 file */ /* EP0 file */
if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs, if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs,
&ffs_ep0_operations, NULL))) &ffs_ep0_operations, NULL)))
goto enomem3; goto Enomem;
return 0; return 0;
enomem3: Enomem:
dput(d);
enomem2:
iput(inode);
enomem1:
ffs_data_put(ffs);
enomem0:
return -ENOMEM; return -ENOMEM;
} }
...@@ -1196,14 +1190,11 @@ ffs_fs_mount(struct file_system_type *t, int flags, ...@@ -1196,14 +1190,11 @@ ffs_fs_mount(struct file_system_type *t, int flags,
static void static void
ffs_fs_kill_sb(struct super_block *sb) ffs_fs_kill_sb(struct super_block *sb)
{ {
void *ptr;
ENTER(); ENTER();
kill_litter_super(sb); kill_litter_super(sb);
ptr = xchg(&sb->s_fs_info, NULL); if (sb->s_fs_info)
if (ptr) ffs_data_put(sb->s_fs_info);
ffs_data_put(ptr);
} }
static struct file_system_type ffs_fs_type = { static struct file_system_type ffs_fs_type = {
......
...@@ -2035,7 +2035,6 @@ static int ...@@ -2035,7 +2035,6 @@ static int
gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
{ {
struct inode *inode; struct inode *inode;
struct dentry *d;
struct dev_data *dev; struct dev_data *dev;
if (the_device) if (the_device)
...@@ -2058,24 +2057,27 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) ...@@ -2058,24 +2057,27 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
NULL, &simple_dir_operations, NULL, &simple_dir_operations,
S_IFDIR | S_IRUGO | S_IXUGO); S_IFDIR | S_IRUGO | S_IXUGO);
if (!inode) if (!inode)
goto enomem0; goto Enomem;
inode->i_op = &simple_dir_inode_operations; inode->i_op = &simple_dir_inode_operations;
if (!(d = d_alloc_root (inode))) if (!(sb->s_root = d_alloc_root (inode))) {
goto enomem1; iput(inode);
sb->s_root = d; goto Enomem;
}
/* the ep0 file is named after the controller we expect; /* the ep0 file is named after the controller we expect;
* user mode code can use it for sanity checks, like we do. * user mode code can use it for sanity checks, like we do.
*/ */
dev = dev_new (); dev = dev_new ();
if (!dev) if (!dev)
goto enomem2; goto Enomem;
dev->sb = sb; dev->sb = sb;
if (!gadgetfs_create_file (sb, CHIP, if (!gadgetfs_create_file (sb, CHIP,
dev, &dev_init_operations, dev, &dev_init_operations,
&dev->dentry)) &dev->dentry)) {
goto enomem3; put_dev(dev);
goto Enomem;
}
/* other endpoint files are available after hardware setup, /* other endpoint files are available after hardware setup,
* from binding to a controller. * from binding to a controller.
...@@ -2083,13 +2085,7 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) ...@@ -2083,13 +2085,7 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
the_device = dev; the_device = dev;
return 0; return 0;
enomem3: Enomem:
put_dev (dev);
enomem2:
dput (d);
enomem1:
iput (inode);
enomem0:
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -301,7 +301,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent) ...@@ -301,7 +301,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
inode = new_inode(s); inode = new_inode(s);
if (!inode) if (!inode)
goto free_fsi; goto fail;
inode->i_ino = 1; inode->i_ino = 1;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
...@@ -316,8 +316,6 @@ devpts_fill_super(struct super_block *s, void *data, int silent) ...@@ -316,8 +316,6 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
printk(KERN_ERR "devpts: get root dentry failed\n"); printk(KERN_ERR "devpts: get root dentry failed\n");
iput(inode); iput(inode);
free_fsi:
kfree(s->s_fs_info);
fail: fail:
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -838,6 +838,8 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -838,6 +838,8 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
ret = bdi_setup_and_register(&sbi->bdi, "exofs", BDI_CAP_MAP_COPY); ret = bdi_setup_and_register(&sbi->bdi, "exofs", BDI_CAP_MAP_COPY);
if (ret) { if (ret) {
EXOFS_DBGMSG("Failed to bdi_setup_and_register\n"); EXOFS_DBGMSG("Failed to bdi_setup_and_register\n");
dput(sb->s_root);
sb->s_root = NULL;
goto free_sbi; goto free_sbi;
} }
......
...@@ -2272,7 +2272,7 @@ static int ext3_symlink (struct inode * dir, ...@@ -2272,7 +2272,7 @@ static int ext3_symlink (struct inode * dir,
err = PTR_ERR(handle); err = PTR_ERR(handle);
goto err_drop_inode; goto err_drop_inode;
} }
inc_nlink(inode); set_nlink(inode, 1);
err = ext3_orphan_del(handle, inode); err = ext3_orphan_del(handle, inode);
if (err) { if (err) {
ext3_journal_stop(handle); ext3_journal_stop(handle);
......
...@@ -2315,7 +2315,7 @@ static int ext4_symlink(struct inode *dir, ...@@ -2315,7 +2315,7 @@ static int ext4_symlink(struct inode *dir,
err = PTR_ERR(handle); err = PTR_ERR(handle);
goto err_drop_inode; goto err_drop_inode;
} }
inc_nlink(inode); set_nlink(inode, 1);
err = ext4_orphan_del(handle, inode); err = ext4_orphan_del(handle, inode);
if (err) { if (err) {
ext4_journal_stop(handle); ext4_journal_stop(handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment