aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/configfs/dir.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 34750d5e4ff2..5e6e37e58f36 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1141,25 +1141,22 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1141 1141
1142 err = -ENOMEM; 1142 err = -ENOMEM;
1143 dentry = d_alloc(configfs_sb->s_root, &name); 1143 dentry = d_alloc(configfs_sb->s_root, &name);
1144 if (!dentry) 1144 if (dentry) {
1145 goto out_release; 1145 d_add(dentry, NULL);
1146
1147 d_add(dentry, NULL);
1148 1146
1149 err = configfs_attach_group(sd->s_element, &group->cg_item, 1147 err = configfs_attach_group(sd->s_element, &group->cg_item,
1150 dentry); 1148 dentry);
1151 if (!err) 1149 if (err) {
1152 dentry = NULL; 1150 d_delete(dentry);
1153 else 1151 dput(dentry);
1154 d_delete(dentry); 1152 }
1153 }
1155 1154
1156 mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex); 1155 mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex);
1157 1156
1158 if (dentry) { 1157 if (err) {
1159 dput(dentry); 1158 unlink_group(group);
1160out_release: 1159 configfs_release_fs();
1161 unlink_group(group);
1162 configfs_release_fs();
1163 } 1160 }
1164 1161
1165 return err; 1162 return err;