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>
This commit is contained in:
Joel Becker 2007-03-05 15:49:49 -08:00 committed by Mark Fasheh
parent 03f981cf2e
commit afdf04ea09
1 changed files with 12 additions and 15 deletions

View File

@ -1141,23 +1141,20 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
err = -ENOMEM;
dentry = d_alloc(configfs_sb->s_root, &name);
if (!dentry)
goto out_release;
if (dentry) {
d_add(dentry, NULL);
err = configfs_attach_group(sd->s_element, &group->cg_item,
dentry);
if (!err)
dentry = NULL;
else
if (err) {
d_delete(dentry);
dput(dentry);
}
}
mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex);
if (dentry) {
dput(dentry);
out_release:
if (err) {
unlink_group(group);
configfs_release_fs();
}