Commit afdf04ea authored by Joel Becker's avatar Joel Becker Committed by Mark Fasheh

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: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent 03f981cf
...@@ -1141,23 +1141,20 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) ...@@ -1141,23 +1141,20 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
err = -ENOMEM; err = -ENOMEM;
dentry = d_alloc(configfs_sb->s_root, &name); dentry = d_alloc(configfs_sb->s_root, &name);
if (!dentry) if (dentry) {
goto out_release;
d_add(dentry, NULL); d_add(dentry, NULL);
err = configfs_attach_group(sd->s_element, &group->cg_item, err = configfs_attach_group(sd->s_element, &group->cg_item,
dentry); dentry);
if (!err) if (err) {
dentry = NULL;
else
d_delete(dentry); d_delete(dentry);
dput(dentry);
}
}
mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex); mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex);
if (dentry) { if (err) {
dput(dentry);
out_release:
unlink_group(group); unlink_group(group);
configfs_release_fs(); configfs_release_fs();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment