mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jules Maselbas <>
Cc: Neeraj Pal <>, Jules Maselbas <>
Subject: [PATCH] fs: Fix link_path_walk to return -ENOENT on empty path
Date: Sun, 18 Apr 2021 01:34:09 +0200	[thread overview]
Message-ID: <> (raw)

link_path_walk was returning 0 when passed with an empty path,
this lead calling code to assume that the struct nameidata nd
is valid and thus has a `last` field populated, which is not.
In the end causing a runtime crash.

This issue can easily be reproduced by running the command:
cat ""

Reported-by: Neeraj Pal <>
Signed-off-by: Jules Maselbas <>
 fs/fs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index a02332491..6de5a3b59 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1928,6 +1928,8 @@ static int link_path_walk(const char *name, struct nameidata *nd)
 	int err;
 	char separator = '/';
+	if (!*name)
+		return -ENOENT;
 	while (*name=='/')
 	if (!*name)

barebox mailing list

             reply	other threads:[~2021-04-17 23:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-17 23:34 Jules Maselbas [this message]
2021-05-03 12:45 ` Sascha Hauer

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \
    --subject='Re: [PATCH] fs: Fix link_path_walk to return -ENOENT on empty path' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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