[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230713-hinhalten-spinnen-7d1c9d0b5200@brauner>
Date: Thu, 13 Jul 2023 14:48:39 +0200
From: Christian Brauner <brauner@...nel.org>
To: Wang Ming <machel@...o.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Dave Chinner <dchinner@...hat.com>,
Xiaokai Ran <ran.xiaokai@....com.cn>,
Al Viro <viro@...iv.linux.org.uk>,
xu xin <xu.xin16@....com.cn>,
Zhihao Cheng <chengzhihao1@...wei.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
opensource.kernel@...o.com
Subject: Re: [PATCH v1] fs: proc: Add error checking for d_hash_and_lookup()
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@...o.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.
Powered by blists - more mailing lists