aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs/dir.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2007-03-05 18:49:49 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2007-03-14 17:37:21 -0400
commitafdf04ea098139e86147f63aad9c383cad3b6f37 (patch)
tree2050cfea8aeea2280182cc0263efbd3ad0505b34 /fs/configfs/dir.c
parent03f981cf2ec95dd8bc43d2ecccaec4e83c8375e2 (diff)
configfs: add missing mutex_unlock()
d_alloc() failure in configfs_register_subsystem() would fail to unlock the mutex taken above. Reorganize the exit path to ensure the unlock happens. Reported-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/configfs/dir.c')
-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;