linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Wang Ming <machel@vivo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Dave Chinner <dchinner@redhat.com>,
	Xiaokai Ran <ran.xiaokai@zte.com.cn>,
	Al Viro <viro@zeniv.linux.org.uk>, xu xin <xu.xin16@zte.com.cn>,
	Zhihao Cheng <chengzhihao1@huawei.com>,
	"Liam R. Howlett" <Liam.Howlett@Oracle.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	opensource.kernel@vivo.com
Subject: Re: [PATCH v1] fs: proc: Add error checking for d_hash_and_lookup()
Date: Thu, 13 Jul 2023 14:48:39 +0200	[thread overview]
Message-ID: <20230713-hinhalten-spinnen-7d1c9d0b5200@brauner> (raw)
In-Reply-To: <20230713113303.6512-1-machel@vivo.com>

On Thu, Jul 13, 2023 at 07:32:48PM +0800, Wang Ming wrote:
> In case of failure, d_hash_and_lookup() returns NULL or an error
> pointer. The proc_fill_cache() needs to add the handling of the
> error pointer returned by d_hash_and_lookup().
> 
> Signed-off-by: Wang Ming <machel@vivo.com>
> ---
>  fs/proc/base.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index bbc998fd2a2f..4c0e8329b318 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -2071,6 +2071,8 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
>  	ino_t ino = 1;
>  
>  	child = d_hash_and_lookup(dir, &qname);
> +	if (IS_ERR(child))
> +		goto end_instantiate;

As procfs doesn't have a separate dentry hash function this doesn't make
much sense. It will always be either NULL or valid.

      reply	other threads:[~2023-07-13 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13 11:32 [PATCH v1] fs: proc: Add error checking for d_hash_and_lookup() Wang Ming
2023-07-13 12:48 ` Christian Brauner [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=20230713-hinhalten-spinnen-7d1c9d0b5200@brauner \
    --to=brauner@kernel.org \
    --cc=Liam.Howlett@Oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=chengzhihao1@huawei.com \
    --cc=dchinner@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=machel@vivo.com \
    --cc=opensource.kernel@vivo.com \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xu.xin16@zte.com.cn \
    /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;
as well as URLs for NNTP newsgroup(s).