mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Jules Maselbas <jmaselbas@kalray.eu>
Cc: barebox@lists.infradead.org, Neeraj Pal <neerajpal09@gmail.com>
Subject: Re: [PATCH] fs: Fix link_path_walk to return -ENOENT on empty path
Date: Mon, 3 May 2021 14:45:47 +0200
Message-ID: <20210503124547.GL19819@pengutronix.de> (raw)
In-Reply-To: <20210417233409.637-1-jmaselbas@kalray.eu>

On Sun, Apr 18, 2021 at 01:34:09AM +0200, Jules Maselbas wrote:
> 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 <neerajpal09@gmail.com>
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> ---
>  fs/fs.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks

Sascha

> 
> 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=='/')
>  		name++;
>  	if (!*name)
> -- 
> 2.17.1
> 
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


      reply	other threads:[~2021-05-03 12:47 UTC|newest]

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

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=20210503124547.GL19819@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jmaselbas@kalray.eu \
    --cc=neerajpal09@gmail.com \
    /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

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git