linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "glaubitz@physik.fu-berlin.de" <glaubitz@physik.fu-berlin.de>,
	"frank.li@vivo.com" <frank.li@vivo.com>,
	"penguin-kernel@I-love.SAKURA.ne.jp"
	<penguin-kernel@I-love.SAKURA.ne.jp>,
	"slava@dubeyko.com" <slava@dubeyko.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re:  [PATCH] hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file()
Date: Mon, 30 Jun 2025 17:18:19 +0000	[thread overview]
Message-ID: <4ce5a57c7b00bbd77d7ad6c23f0dcc55f99c3d1a.camel@ibm.com> (raw)
In-Reply-To: <54358ab7-4525-48ba-a1e5-595f6b107cc6@I-love.SAKURA.ne.jp>

On Wed, 2025-06-25 at 19:10 +0900, Tetsuo Handa wrote:
> syzkaller can mount crafted filesystem images.
> Don't crash the kernel when we can continue.
> 
> Reported-by: syzbot <syzbot+1107451c16b9eb9d29e6@syzkaller.appspotmail.com>
> Closes: https://syzkaller.appspot.com/bug?extid=1107451c16b9eb9d29e6  
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
>  fs/hfsplus/xattr.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
> index 9a1a93e3888b..191767d4cf78 100644
> --- a/fs/hfsplus/xattr.c
> +++ b/fs/hfsplus/xattr.c
> @@ -172,7 +172,11 @@ static int hfsplus_create_attributes_file(struct super_block *sb)
>  		return PTR_ERR(attr_file);
>  	}
>  
> -	BUG_ON(i_size_read(attr_file) != 0);

So, it's something like unexpected situation here. Why do we have
i_size_read(attr_file) != 0 here? It looks like hfsplus_create_attributes_file()
was called in incorrect context. Probably, it's not the whole fix. Any ideas?

> +	if (i_size_read(attr_file) != 0) {
> +		err = -EIO;
> +		pr_err("failed to load attributes file\n");
> +		goto end_attr_file_creation;
> +	}
>  
>  	hip = HFSPLUS_I(attr_file);
>  

Makes sense to me. Looks good.

Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>

Thanks,
Slava.

  reply	other threads:[~2025-06-30 17:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25 10:10 [PATCH] hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file() Tetsuo Handa
2025-06-30 17:18 ` Viacheslav Dubeyko [this message]
2025-07-07 14:22   ` Yangtao Li
2025-07-07 14:45     ` Tetsuo Handa
2025-07-07 19:03       ` Viacheslav Dubeyko
2025-07-09 14:02         ` Tetsuo Handa
2025-07-09 18:33           ` Viacheslav Dubeyko
2025-07-09 22:03             ` Tetsuo Handa
2025-07-11 11:35               ` Tetsuo Handa
2025-07-11 17:21                 ` Viacheslav Dubeyko
2025-07-12 11:22                   ` Tetsuo Handa
2025-07-14 23:30                     ` Viacheslav Dubeyko
2025-07-15  5:17                       ` [PATCH v2] " Tetsuo Handa
2025-07-15 18:49                         ` Viacheslav Dubeyko

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=4ce5a57c7b00bbd77d7ad6c23f0dcc55f99c3d1a.camel@ibm.com \
    --to=slava.dubeyko@ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=frank.li@vivo.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=slava@dubeyko.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
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;
as well as URLs for NNTP newsgroup(s).