From: "J. Bruce Fields" <bfields@fieldses.org>
To: Andrey Vagin <avagin@openvz.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Tejun Heo <tj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] fs: Correctly check d_find_alias() return code in devpts_pty_kill
Date: Fri, 4 Feb 2011 13:11:16 -0500 [thread overview]
Message-ID: <20110204181116.GA12304@fieldses.org> (raw)
In-Reply-To: <1296833307-22549-1-git-send-email-avagin@openvz.org>
On Fri, Feb 04, 2011 at 06:28:26PM +0300, Andrey Vagin wrote:
> d_find_alias() return NULL in case error, but we expected errno in
> devpts_pty_kill.
Possibly dumb question: can d_find_alias() actually fail here?
--b.
>
> Signed-off-by: Andrey Vagin <avagin@openvz.org>
> ---
> fs/devpts/inode.c | 10 ++++------
> 1 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
> index 8392c8c..530b1f1 100644
> --- a/fs/devpts/inode.c
> +++ b/fs/devpts/inode.c
> @@ -544,14 +544,12 @@ void devpts_pty_kill(struct tty_struct *tty)
> mutex_lock(&root->d_inode->i_mutex);
>
> dentry = d_find_alias(inode);
> - if (IS_ERR(dentry))
> + if (!dentry)
> goto out;
>
> - if (dentry) {
> - inode->i_nlink--;
> - d_delete(dentry);
> - dput(dentry); /* d_alloc_name() in devpts_pty_new() */
> - }
> + inode->i_nlink--;
> + d_delete(dentry);
> + dput(dentry); /* d_alloc_name() in devpts_pty_new() */
>
> dput(dentry); /* d_find_alias above */
> out:
> --
> 1.7.2.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
prev parent reply other threads:[~2011-02-04 18:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 15:28 Andrey Vagin
2011-02-04 15:28 ` [PATCH 2/2] fs: devpts_pty_new() return -ENOMEM if dentry allocation failed Andrey Vagin
2011-02-04 18:11 ` J. Bruce Fields [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=20110204181116.GA12304@fieldses.org \
--to=bfields@fieldses.org \
--cc=akpm@linux-foundation.org \
--cc=avagin@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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
all inboxes | Powered by JetHome®