public inbox for linux-erofs@ozlabs.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Ajay Rajera <newajay.11r@gmail.com>, linux-erofs@lists.ozlabs.org
Cc: xiang@kernel.org
Subject: Re: [PATCH v2 1/2] erofs-utils: fuse: add missing return on getattr error
Date: Sat, 21 Mar 2026 14:43:09 +0800	[thread overview]
Message-ID: <cb307f5e-bb07-4456-8bb9-7d4697171d14@linux.alibaba.com> (raw)
In-Reply-To: <20260321062604.1905-1-newajay.11r@gmail.com>



On 2026/3/21 14:26, Ajay Rajera wrote:
> erofsfuse_getattr() calls fuse_reply_err() when erofs_read_inode_from_disk()
> fails, but does not return afterwards. This causes the function to fall through
> to erofsfuse_fill_stat() with uninitialized inode data and then call
> fuse_reply_attr(), sending a second reply to the same FUSE request.
> 
> Sending two replies to a single FUSE request is undefined behavior in libfuse
> and typically triggers an assertion failure or crash. The uninitialized inode
> data may also expose garbage values to userspace.
> 
> Fix by adding the missing return after fuse_reply_err().

Each line of the commit message should not exceed 72 chars.

> 
> Signed-off-by: Ajay Rajera <newajay.11r@gmail.com>
> ---
>   fuse/main.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fuse/main.c b/fuse/main.c
> index 82aca8c..b634782 100644
> --- a/fuse/main.c
> +++ b/fuse/main.c
> @@ -265,8 +265,10 @@ static void erofsfuse_getattr(fuse_req_t req, fuse_ino_t ino,
>   	struct erofs_inode vi = { .sbi = &g_sbi, .nid = erofsfuse_to_nid(ino) };
>   
>   	ret = erofs_read_inode_from_disk(&vi);
> -	if (ret < 0)
> +	if (ret < 0) {
>   		fuse_reply_err(req, -ret);
> +		return;
> +	}
>   
>   	erofsfuse_fill_stat(&vi, &stbuf);
>   	stbuf.st_ino = ino;



  parent reply	other threads:[~2026-03-21  6:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21  6:26 [PATCH v2 1/2] erofs-utils: fuse: add missing return on getattr error Ajay Rajera
2026-03-21  6:26 ` [PATCH v2 2/2] erofs-utils: lib: fix memory leak in erofs_gzran_builder_init error path Ajay Rajera
2026-03-21  7:21   ` Gao Xiang
2026-03-21  9:34     ` Ajay Rajera
2026-03-21  6:43 ` Gao Xiang [this message]
2026-03-21  7:18   ` [PATCH v2 1/2] erofs-utils: fuse: add missing return on getattr error Ajay Rajera

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=cb307f5e-bb07-4456-8bb9-7d4697171d14@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=newajay.11r@gmail.com \
    --cc=xiang@kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox