linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "frank.li@vivo.com" <frank.li@vivo.com>,
	"glaubitz@physik.fu-berlin.de" <glaubitz@physik.fu-berlin.de>,
	"penguin-kernel@I-love.SAKURA.ne.jp"
	<penguin-kernel@I-love.SAKURA.ne.jp>,
	"slava@dubeyko.com" <slava@dubeyko.com>,
	"brauner@kernel.org" <brauner@kernel.org>,
	"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 v2] hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file()
Date: Tue, 15 Jul 2025 18:49:35 +0000	[thread overview]
Message-ID: <d27ab621d904eda6f10fb3fdd280feb0f04e3afb.camel@ibm.com> (raw)
In-Reply-To: <7b587d24-c8a1-4413-9b9a-00a33fbd849f@I-love.SAKURA.ne.jp>

On Tue, 2025-07-15 at 14:17 +0900, Tetsuo Handa wrote:
> When the volume header contains erroneous values that do not reflect
> the actual state of the filesystem, hfsplus_fill_super() assumes that
> the attributes file is not yet created, which later results in hitting
> BUG_ON() when hfsplus_create_attributes_file() is called. Replace this
> BUG_ON() with -EIO error with a message to suggest running fsck tool.
> 
> 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..18dc3d254d21 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);
> +	if (i_size_read(attr_file) != 0) {
> +		err = -EIO;
> +		pr_err("detected inconsistent attributes file, running fsck.hfsplus is recommended.\n");
> +		goto end_attr_file_creation;
> +	}
>  
>  	hip = HFSPLUS_I(attr_file);
>  

Looks good!

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

Thanks,
Slava.

      reply	other threads:[~2025-07-15 18:49 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
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 [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=d27ab621d904eda6f10fb3fdd280feb0f04e3afb.camel@ibm.com \
    --to=slava.dubeyko@ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.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).