Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] smb: client: add NULL check in automount_fullpath
@ 2025-06-01 17:18 Ruben Devos
  2025-06-01 20:13 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Ruben Devos @ 2025-06-01 17:18 UTC (permalink / raw)
  To: sfrench
  Cc: pc, ronniesahlberg, sprasad, tom, bharathsm, linux-cifs,
	Ruben Devos

page is checked for null in __build_path_from_dentry_optional_prefix
when tcon->origin_fullpath is not set. However, the check is missing when
it is set.
Add a check to prevent a potential NULL pointer dereference.

Signed-off-by: Ruben Devos <devosruben6@gmail.com>
---
 fs/smb/client/namespace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/smb/client/namespace.c b/fs/smb/client/namespace.c
index e3f9213131c4..a6655807c086 100644
--- a/fs/smb/client/namespace.c
+++ b/fs/smb/client/namespace.c
@@ -146,6 +146,9 @@ static char *automount_fullpath(struct dentry *dentry, void *page)
 	}
 	spin_unlock(&tcon->tc_lock);
 
+	if (unlikely(!page))
+		return ERR_PTR(-ENOMEM);
+
 	s = dentry_path_raw(dentry, page, PATH_MAX);
 	if (IS_ERR(s))
 		return s;
-- 
2.49.0


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

end of thread, other threads:[~2025-06-01 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-01 17:18 [PATCH] smb: client: add NULL check in automount_fullpath Ruben Devos
2025-06-01 20:13 ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox