From: Wang Ming <machel@vivo.com>
To: Christian Brauner <brauner@kernel.org>,
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
Cc: opensource.kernel@vivo.com, Wang Ming <machel@vivo.com>
Subject: [PATCH v1] fs: proc: Add error checking for d_hash_and_lookup()
Date: Thu, 13 Jul 2023 19:32:48 +0800 [thread overview]
Message-ID: <20230713113303.6512-1-machel@vivo.com> (raw)
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;
if (!child) {
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
child = d_alloc_parallel(dir, &qname, &wq);
--
2.25.1
next reply other threads:[~2023-07-13 11:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 11:32 Wang Ming [this message]
2023-07-13 12:48 ` [PATCH v1] fs: proc: Add error checking for d_hash_and_lookup() Christian Brauner
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=20230713113303.6512-1-machel@vivo.com \
--to=machel@vivo.com \
--cc=Liam.Howlett@Oracle.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=chengzhihao1@huawei.com \
--cc=dchinner@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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).