[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4c1eb34018cabe33f81b1aa13d5eb0adc44661e7.camel@dubeyko.com>
Date: Tue, 15 Jul 2025 12:20:17 -0700
From: Viacheslav Dubeyko <slava@...eyko.com>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>, John Paul Adrian
Glaubitz <glaubitz@...sik.fu-berlin.de>, Yangtao Li <frank.li@...o.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-fsdevel
<linux-fsdevel@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v2] hfs: remove BUG() from
hfs_release_folio()/hfs_test_inode()/hfs_write_inode()
On Tue, 2025-07-15 at 15:51 +0900, Tetsuo Handa wrote:
> Since syzkaller can mount crafted filesystem images with inode->ino
> == 0
> (which is not listed as "Some special File ID numbers" in
> fs/hfs/hfs.h ),
> replace BUG() with pr_warn().
>
> Reported-by: syzbot+97e301b4b82ae803d21b@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=97e301b4b82ae803d21b
> Tested-by: syzbot+97e301b4b82ae803d21b@...kaller.appspotmail.com
> Signed-off-by: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
> ---
> fs/hfs/inode.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
> index a81ce7a740b9..794d710c3ae0 100644
> --- a/fs/hfs/inode.c
> +++ b/fs/hfs/inode.c
> @@ -81,7 +81,7 @@ static bool hfs_release_folio(struct folio *folio,
> gfp_t mask)
> tree = HFS_SB(sb)->cat_tree;
> break;
> default:
> - BUG();
> + pr_warn("unexpected inode %lu at %s()\n", inode-
> >i_ino, __func__);
I don't think that it makes sense to add the function name here. I
understand that you would like to be informative here. But, usually,
HFS code doesn't show the the function name in error messages.
By the way, why are you using pr_warn() but not pr_err()? Any
particular reason to use namely pr_warn()?
We had BUG() here before and, potentially, we could use pr_warn() +
dump_stack() to be really informative here.
> return false;
> }
>
> @@ -305,7 +305,7 @@ static int hfs_test_inode(struct inode *inode,
> void *data)
> case HFS_CDR_FIL:
> return inode->i_ino == be32_to_cpu(rec->file.FlNum);
> default:
> - BUG();
> + pr_warn("unexpected type %u at %s()\n", rec->type,
> __func__);
Ditto.
> return 1;
> }
> }
> @@ -441,7 +441,7 @@ int hfs_write_inode(struct inode *inode, struct
> writeback_control *wbc)
> hfs_btree_write(HFS_SB(inode->i_sb)-
> >cat_tree);
> return 0;
> default:
> - BUG();
> + pr_warn("unexpected inode %lu at %s()\n",
> inode->i_ino, __func__);
Ditto.
Thanks,
Slava.
> return -EIO;
> }
> }
Powered by blists - more mailing lists