mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
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:
parent
03f981cf2e
commit
afdf04ea09
@ -1141,25 +1141,22 @@ 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,
|
||||||
|
dentry);
|
||||||
err = configfs_attach_group(sd->s_element, &group->cg_item,
|
if (err) {
|
||||||
dentry);
|
d_delete(dentry);
|
||||||
if (!err)
|
dput(dentry);
|
||||||
dentry = NULL;
|
}
|
||||||
else
|
}
|
||||||
d_delete(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);
|
unlink_group(group);
|
||||||
out_release:
|
configfs_release_fs();
|
||||||
unlink_group(group);
|
|
||||||
configfs_release_fs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
Loading…
Reference in New Issue
Block a user