hfsplus: creation of hidden dir on mount can fail
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 10 Jan 2012 22:48:52 +0000 (17:48 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 10 Jan 2012 22:48:52 +0000 (17:48 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/hfsplus/super.c

index edf0a801446b3d83c4c1e0e04cf88e546317760e..427682ca9e48d3e6aeac2087100c40725a811e2c 100644 (file)
@@ -499,9 +499,16 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
                if (!sbi->hidden_dir) {
                        mutex_lock(&sbi->vh_mutex);
                        sbi->hidden_dir = hfsplus_new_inode(sb, S_IFDIR);
-                       hfsplus_create_cat(sbi->hidden_dir->i_ino, root, &str,
-                                          sbi->hidden_dir);
+                       if (!sbi->hidden_dir) {
+                               mutex_unlock(&sbi->vh_mutex);
+                               err = -ENOMEM;
+                               goto out_put_root;
+                       }
+                       err = hfsplus_create_cat(sbi->hidden_dir->i_ino, root,
+                                                &str, sbi->hidden_dir);
                        mutex_unlock(&sbi->vh_mutex);
+                       if (err)
+                               goto out_put_hidden_dir;
 
                        hfsplus_mark_inode_dirty(sbi->hidden_dir,
                                                 HFSPLUS_I_CAT_DIRTY);