[PATCH 2/3] fs: check for valid name in filename_lookup()

Sascha Hauer s.hauer at pengutronix.de
Fri May 7 03:56:10 PDT 2021


The getname() return value is passed to filename_lookup() without
checking the return value, so this must be done in filename_lookup().

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 fs/fs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 09fccf9c28..2eaf7eaa37 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -2189,6 +2189,9 @@ static int filename_lookup(int dfd, struct filename *name, unsigned flags,
 	struct nameidata nd;
 	const char *s;
 
+	if (IS_ERR(name))
+		return PTR_ERR(name);
+
 	set_nameidata(&nd, dfd, name);
 
 	s = path_init(&nd, flags);
-- 
2.29.2




More information about the barebox mailing list