RE: [GIT PULL] hfs/hfsplus changes for 7.0-rc1

From: Viacheslav Dubeyko

Date: Tue Feb 10 2026 - 13:15:53 EST


On Tue, 2026-02-10 at 20:12 +0900, Tetsuo Handa wrote:
> On 2026/02/07 9:26, Viacheslav Dubeyko wrote:
> > Jori Koolstra has fixed the syzbot reported issue of triggering
> > BUG_ON() in the case of corrupted superblock. This patch replaces
> > the BUG_ON() in multiple places with proper error handling and
> > resolves the syzbot reported bug.
>
> I think that commit b226804532a8 ("hfs: Replace BUG_ON with error handling for CNID count checks") is incomplete.
>
> Since atomic64_t is signed 64bits and U32_MAX is unsigned 32bits, the comparison
> "if (atomic64_read(&sbi->next_id) > U32_MAX)" becomes false when sbi->next_id >= ((-1ULL) / 2) + 1.
> I guess that a corrupted filesystem can have e.g. sbi->next_id == -1, and
> "if (atomic64_read(&sbi->next_id) >> 32)" would check that the upper 32bits are all 0.
>
>
>
> Also, I confirmed that this pull request did not include a fix for
> https://urldefense.proofpoint.com/v2/url?u=https-3A__syzkaller.appspot.com_bug-3Fid-3Dee595bf9e099fff0610828e37bbbcdb7a2933f58&d=DwICaQ&c=BSDicqBQBDjDI9RkVyTcHQ&r=q5bIm4AXMzc8NJu1_RGmnQ2fMWKq4Y4RAkElvUgSs00&m=oSYPrjvqOFJcM1QikgNde5oUhIdGdMpum5UQMLayiJS0yQrJtT-rfZXJJ6rqaBd_&s=ztXY-L3aBc2mxTwLuNk3drfU-ca8BOnIOSLbfUesA-o&e= .
> I'm waiting for next version of patch for this problem.
>

If something was missed in the patch, then you or Jori are welcome to send the
fix.

Thanks,
Slava.