diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 11:31:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 11:31:22 -0500 |
commit | c99516ca854770000c277b2680a15581c691e18c (patch) | |
tree | b2bc5a297f3996668cea3f9445645d25b607f644 | |
parent | 72f318897e50c29b91efd1ed24515a93c138a2ba (diff) | |
parent | 0ce8c0109f548ed75535d96ec5a347b410ed1472 (diff) |
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
-rw-r--r-- | drivers/usb/gadget/f_fs.c | 31 | ||||
-rw-r--r-- | drivers/usb/gadget/inode.c | 26 | ||||
-rw-r--r-- | fs/devpts/inode.c | 4 | ||||
-rw-r--r-- | fs/exofs/super.c | 2 | ||||
-rw-r--r-- | fs/ext3/namei.c | 2 | ||||
-rw-r--r-- | fs/ext4/namei.c | 2 |
6 files changed, 27 insertions, 40 deletions
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index acb38004eec0..b5f6f9fef9c7 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -1037,7 +1037,6 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent) | |||
1037 | { | 1037 | { |
1038 | struct ffs_sb_fill_data *data = _data; | 1038 | struct ffs_sb_fill_data *data = _data; |
1039 | struct inode *inode; | 1039 | struct inode *inode; |
1040 | struct dentry *d; | ||
1041 | struct ffs_data *ffs; | 1040 | struct ffs_data *ffs; |
1042 | 1041 | ||
1043 | ENTER(); | 1042 | ENTER(); |
@@ -1045,7 +1044,7 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent) | |||
1045 | /* Initialise data */ | 1044 | /* Initialise data */ |
1046 | ffs = ffs_data_new(); | 1045 | ffs = ffs_data_new(); |
1047 | if (unlikely(!ffs)) | 1046 | if (unlikely(!ffs)) |
1048 | goto enomem0; | 1047 | goto Enomem; |
1049 | 1048 | ||
1050 | ffs->sb = sb; | 1049 | ffs->sb = sb; |
1051 | ffs->dev_name = data->dev_name; | 1050 | ffs->dev_name = data->dev_name; |
@@ -1065,26 +1064,21 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent) | |||
1065 | &simple_dir_inode_operations, | 1064 | &simple_dir_inode_operations, |
1066 | &data->perms); | 1065 | &data->perms); |
1067 | if (unlikely(!inode)) | 1066 | if (unlikely(!inode)) |
1068 | goto enomem1; | 1067 | goto Enomem; |
1069 | d = d_alloc_root(inode); | 1068 | sb->s_root = d_alloc_root(inode); |
1070 | if (unlikely(!d)) | 1069 | if (unlikely(!sb->s_root)) { |
1071 | goto enomem2; | 1070 | iput(inode); |
1072 | sb->s_root = d; | 1071 | goto Enomem; |
1072 | } | ||
1073 | 1073 | ||
1074 | /* EP0 file */ | 1074 | /* EP0 file */ |
1075 | if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs, | 1075 | if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs, |
1076 | &ffs_ep0_operations, NULL))) | 1076 | &ffs_ep0_operations, NULL))) |
1077 | goto enomem3; | 1077 | goto Enomem; |
1078 | 1078 | ||
1079 | return 0; | 1079 | return 0; |
1080 | 1080 | ||
1081 | enomem3: | 1081 | Enomem: |
1082 | dput(d); | ||
1083 | enomem2: | ||
1084 | iput(inode); | ||
1085 | enomem1: | ||
1086 | ffs_data_put(ffs); | ||
1087 | enomem0: | ||
1088 | return -ENOMEM; | 1082 | return -ENOMEM; |
1089 | } | 1083 | } |
1090 | 1084 | ||
@@ -1196,14 +1190,11 @@ ffs_fs_mount(struct file_system_type *t, int flags, | |||
1196 | static void | 1190 | static void |
1197 | ffs_fs_kill_sb(struct super_block *sb) | 1191 | ffs_fs_kill_sb(struct super_block *sb) |
1198 | { | 1192 | { |
1199 | void *ptr; | ||
1200 | |||
1201 | ENTER(); | 1193 | ENTER(); |
1202 | 1194 | ||
1203 | kill_litter_super(sb); | 1195 | kill_litter_super(sb); |
1204 | ptr = xchg(&sb->s_fs_info, NULL); | 1196 | if (sb->s_fs_info) |
1205 | if (ptr) | 1197 | ffs_data_put(sb->s_fs_info); |
1206 | ffs_data_put(ptr); | ||
1207 | } | 1198 | } |
1208 | 1199 | ||
1209 | static struct file_system_type ffs_fs_type = { | 1200 | static struct file_system_type ffs_fs_type = { |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 6ccae2707e59..6b7ea25af0fe 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -2035,7 +2035,6 @@ static int | |||
2035 | gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) | 2035 | gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) |
2036 | { | 2036 | { |
2037 | struct inode *inode; | 2037 | struct inode *inode; |
2038 | struct dentry *d; | ||
2039 | struct dev_data *dev; | 2038 | struct dev_data *dev; |
2040 | 2039 | ||
2041 | if (the_device) | 2040 | if (the_device) |
@@ -2058,24 +2057,27 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) | |||
2058 | NULL, &simple_dir_operations, | 2057 | NULL, &simple_dir_operations, |
2059 | S_IFDIR | S_IRUGO | S_IXUGO); | 2058 | S_IFDIR | S_IRUGO | S_IXUGO); |
2060 | if (!inode) | 2059 | if (!inode) |
2061 | goto enomem0; | 2060 | goto Enomem; |
2062 | inode->i_op = &simple_dir_inode_operations; | 2061 | inode->i_op = &simple_dir_inode_operations; |
2063 | if (!(d = d_alloc_root (inode))) | 2062 | if (!(sb->s_root = d_alloc_root (inode))) { |
2064 | goto enomem1; | 2063 | iput(inode); |
2065 | sb->s_root = d; | 2064 | goto Enomem; |
2065 | } | ||
2066 | 2066 | ||
2067 | /* the ep0 file is named after the controller we expect; | 2067 | /* the ep0 file is named after the controller we expect; |
2068 | * user mode code can use it for sanity checks, like we do. | 2068 | * user mode code can use it for sanity checks, like we do. |
2069 | */ | 2069 | */ |
2070 | dev = dev_new (); | 2070 | dev = dev_new (); |
2071 | if (!dev) | 2071 | if (!dev) |
2072 | goto enomem2; | 2072 | goto Enomem; |
2073 | 2073 | ||
2074 | dev->sb = sb; | 2074 | dev->sb = sb; |
2075 | if (!gadgetfs_create_file (sb, CHIP, | 2075 | if (!gadgetfs_create_file (sb, CHIP, |
2076 | dev, &dev_init_operations, | 2076 | dev, &dev_init_operations, |
2077 | &dev->dentry)) | 2077 | &dev->dentry)) { |
2078 | goto enomem3; | 2078 | put_dev(dev); |
2079 | goto Enomem; | ||
2080 | } | ||
2079 | 2081 | ||
2080 | /* other endpoint files are available after hardware setup, | 2082 | /* other endpoint files are available after hardware setup, |
2081 | * from binding to a controller. | 2083 | * from binding to a controller. |
@@ -2083,13 +2085,7 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) | |||
2083 | the_device = dev; | 2085 | the_device = dev; |
2084 | return 0; | 2086 | return 0; |
2085 | 2087 | ||
2086 | enomem3: | 2088 | Enomem: |
2087 | put_dev (dev); | ||
2088 | enomem2: | ||
2089 | dput (d); | ||
2090 | enomem1: | ||
2091 | iput (inode); | ||
2092 | enomem0: | ||
2093 | return -ENOMEM; | 2089 | return -ENOMEM; |
2094 | } | 2090 | } |
2095 | 2091 | ||
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 79673eb71151..c4e2a58a2e82 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
@@ -301,7 +301,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent) | |||
301 | 301 | ||
302 | inode = new_inode(s); | 302 | inode = new_inode(s); |
303 | if (!inode) | 303 | if (!inode) |
304 | goto free_fsi; | 304 | goto fail; |
305 | inode->i_ino = 1; | 305 | inode->i_ino = 1; |
306 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 306 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
307 | inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; | 307 | 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 | printk(KERN_ERR "devpts: get root dentry failed\n"); | 316 | printk(KERN_ERR "devpts: get root dentry failed\n"); |
317 | iput(inode); | 317 | iput(inode); |
318 | 318 | ||
319 | free_fsi: | ||
320 | kfree(s->s_fs_info); | ||
321 | fail: | 319 | fail: |
322 | return -ENOMEM; | 320 | return -ENOMEM; |
323 | } | 321 | } |
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 8addfe314dc7..d22cd168c6ee 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -838,6 +838,8 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) | |||
838 | ret = bdi_setup_and_register(&sbi->bdi, "exofs", BDI_CAP_MAP_COPY); | 838 | ret = bdi_setup_and_register(&sbi->bdi, "exofs", BDI_CAP_MAP_COPY); |
839 | if (ret) { | 839 | if (ret) { |
840 | EXOFS_DBGMSG("Failed to bdi_setup_and_register\n"); | 840 | EXOFS_DBGMSG("Failed to bdi_setup_and_register\n"); |
841 | dput(sb->s_root); | ||
842 | sb->s_root = NULL; | ||
841 | goto free_sbi; | 843 | goto free_sbi; |
842 | } | 844 | } |
843 | 845 | ||
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 4f35b2f315d4..d269821203fd 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -2272,7 +2272,7 @@ retry: | |||
2272 | err = PTR_ERR(handle); | 2272 | err = PTR_ERR(handle); |
2273 | goto err_drop_inode; | 2273 | goto err_drop_inode; |
2274 | } | 2274 | } |
2275 | inc_nlink(inode); | 2275 | set_nlink(inode, 1); |
2276 | err = ext3_orphan_del(handle, inode); | 2276 | err = ext3_orphan_del(handle, inode); |
2277 | if (err) { | 2277 | if (err) { |
2278 | ext3_journal_stop(handle); | 2278 | ext3_journal_stop(handle); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 86edc45b52a4..2043f482375d 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2315,7 +2315,7 @@ retry: | |||
2315 | err = PTR_ERR(handle); | 2315 | err = PTR_ERR(handle); |
2316 | goto err_drop_inode; | 2316 | goto err_drop_inode; |
2317 | } | 2317 | } |
2318 | inc_nlink(inode); | 2318 | set_nlink(inode, 1); |
2319 | err = ext4_orphan_del(handle, inode); | 2319 | err = ext4_orphan_del(handle, inode); |
2320 | if (err) { | 2320 | if (err) { |
2321 | ext4_journal_stop(handle); | 2321 | ext4_journal_stop(handle); |