linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] fs: proc: Add error checking for d_hash_and_lookup()
@ 2023-07-13 11:32 Wang Ming
  2023-07-13 12:48 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Ming @ 2023-07-13 11:32 UTC (permalink / raw)
  To: Christian Brauner, Andrew Morton, Dave Chinner, Xiaokai Ran,
	Al Viro, xu xin, Zhihao Cheng, Liam R. Howlett, linux-kernel,
	linux-fsdevel
  Cc: opensource.kernel, Wang Ming

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-13 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).