Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=456ef1553cb2b06729d64c1d1f0f2bda34e9b201
Commit:     456ef1553cb2b06729d64c1d1f0f2bda34e9b201
Parent:     e49452c67703d3647467d65275fb893589384fed
Author:     Tejun Heo <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 16 12:10:53 2008 +0900
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Jan 16 09:54:03 2008 -0800

    sysfs: fix bugs in sysfs_rename/move_dir()
    
    sysfs_rename/move_dir() have the following bugs.
    
     - On dentry lookup failure, kfree() is called on ERR_PTR() value.
     - sysfs_move_dir() has an extra dput() on success path.
    
    Fix them.
    
    Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/sysfs/dir.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index b197016..f281cc6 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -783,6 +783,7 @@ int sysfs_rename_dir(struct kobject * kobj, const char 
*new_name)
        old_dentry = sysfs_get_dentry(sd);
        if (IS_ERR(old_dentry)) {
                error = PTR_ERR(old_dentry);
+               old_dentry = NULL;
                goto out;
        }
 
@@ -850,6 +851,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject 
*new_parent_kobj)
        old_dentry = sysfs_get_dentry(sd);
        if (IS_ERR(old_dentry)) {
                error = PTR_ERR(old_dentry);
+               old_dentry = NULL;
                goto out;
        }
        old_parent = old_dentry->d_parent;
@@ -857,6 +859,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject 
*new_parent_kobj)
        new_parent = sysfs_get_dentry(new_parent_sd);
        if (IS_ERR(new_parent)) {
                error = PTR_ERR(new_parent);
+               new_parent = NULL;
                goto out;
        }
 
@@ -880,7 +883,6 @@ again:
        error = 0;
        d_add(new_dentry, NULL);
        d_move(old_dentry, new_dentry);
-       dput(new_dentry);
 
        /* Remove from old parent's list and insert into new parent's list. */
        sysfs_unlink_sibling(sd);
-
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