ecryptfs: remove unneeded buggy code in ecryptfs_do_create()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Mon, 22 Sep 2014 20:39:31 +0000 (00:39 +0400)
committerTyler Hicks <tyhicks@canonical.com>
Mon, 6 Oct 2014 21:54:50 +0000 (16:54 -0500)
There is a bug in error handling of lock_parent() in ecryptfs_do_create():
lock_parent() acquries mutex even if dget_parent() fails, so mutex should be unlocked anyway.

But dget_parent() does not fail, so the patch just removes unneeded buggy code.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
fs/ecryptfs/inode.c

index 7e405396dc05400f3e9a1c440f718e18e40d59b5..e8e22535d9fbd2e9224b8f4dcfb97c71f97d42db 100644 (file)
@@ -190,12 +190,6 @@ ecryptfs_do_create(struct inode *directory_inode,
 
        lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
        lower_dir_dentry = lock_parent(lower_dentry);
-       if (IS_ERR(lower_dir_dentry)) {
-               ecryptfs_printk(KERN_ERR, "Error locking directory of "
-                               "dentry\n");
-               inode = ERR_CAST(lower_dir_dentry);
-               goto out;
-       }
        rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, true);
        if (rc) {
                printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
@@ -213,7 +207,6 @@ ecryptfs_do_create(struct inode *directory_inode,
        fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode);
 out_lock:
        unlock_dir(lower_dir_dentry);
-out:
        return inode;
 }