From: Tyler Hicks <tyhicks@canonical.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
ldv-project@linuxtesting.org
Subject: Re: [PATCH] ecryptfs: remove unneeded buggy code in ecryptfs_do_create()
Date: Thu, 9 Oct 2014 17:26:12 -0500 [thread overview]
Message-ID: <20141009222611.GB24046@boyd> (raw)
In-Reply-To: <1411418371-11953-1-git-send-email-khoroshilov@ispras.ru>
[-- Attachment #1: Type: text/plain, Size: 1629 bytes --]
Hi Alexey - thanks for the patch.
On 2014-09-23 00:39:31, Alexey Khoroshilov wrote:
> 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>
This looks good to me and I've included it in the pull request that I
just sent to Linus. Thanks!
Tyler
> ---
> fs/ecryptfs/inode.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
> index d4a9431ec73c..97735c75085f 100644
> --- a/fs/ecryptfs/inode.c
> +++ b/fs/ecryptfs/inode.c
> @@ -192,12 +192,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; "
> @@ -215,7 +209,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;
> }
>
> --
> 1.9.1
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2014-10-09 22:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-22 20:39 [PATCH] ecryptfs: remove unneeded buggy code in ecryptfs_do_create() Alexey Khoroshilov
2014-10-09 22:26 ` Tyler Hicks [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141009222611.GB24046@boyd \
--to=tyhicks@canonical.com \
--cc=ecryptfs@vger.kernel.org \
--cc=khoroshilov@ispras.ru \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox