mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04: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 <[email protected]> Signed-off-by: Joel Becker <[email protected]> Signed-off-by: Mark Fasheh <[email protected]>
This commit is contained in:
parent
03f981cf2e
commit
afdf04ea09
1 changed files with 12 additions and 15 deletions
|
|
@ -1141,25 +1141,22 @@ 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);
|
||||
|
||||
d_add(dentry, NULL);
|
||||
|
||||
err = configfs_attach_group(sd->s_element, &group->cg_item,
|
||||
dentry);
|
||||
if (!err)
|
||||
dentry = NULL;
|
||||
else
|
||||
d_delete(dentry);
|
||||
err = configfs_attach_group(sd->s_element, &group->cg_item,
|
||||
dentry);
|
||||
if (err) {
|
||||
d_delete(dentry);
|
||||
dput(dentry);
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex);
|
||||
|
||||
if (dentry) {
|
||||
dput(dentry);
|
||||
out_release:
|
||||
unlink_group(group);
|
||||
configfs_release_fs();
|
||||
if (err) {
|
||||
unlink_group(group);
|
||||
configfs_release_fs();
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
|
|||
Loading…
Reference in a new issue