Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=afdf04ea098139e86147f63aad9c383cad3b6f37
Commit:     afdf04ea098139e86147f63aad9c383cad3b6f37
Parent:     03f981cf2ec95dd8bc43d2ecccaec4e83c8375e2
Author:     Joel Becker <[EMAIL PROTECTED]>
AuthorDate: Mon Mar 5 15:49:49 2007 -0800
Committer:  Mark Fasheh <[EMAIL PROTECTED]>
CommitDate: Wed Mar 14 14:37:21 2007 -0700

    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]>
---
 fs/configfs/dir.c |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 34750d5..5e6e37e 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -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;
-
-       d_add(dentry, NULL);
+       if (dentry) {
+               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;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to