Re: [PATCH] buffer: fix NULL dereference of bh->b_folio in __bh_submit()

From: Greg Ociepka

Date: Fri Sep 04 2026 - 01:45:05 EST


On Wed, 2 Sep 2026 09:33:57 +0800, Joseph Qi wrote:
> Since commit 8deae2284976 ("buffer: allow a buffer_head to point at
> memory outside the page cache"), bh->b_folio may be NULL.

We hit the same NULL dereference independently on real hardware, and
it is nastier than a fuzzer-only finding: on an ext4 root filesystem
every boot of next-20260831 (and every later tag up to next-20260903)
dies about two minutes in. jbd2's shadow buffers have no b_folio by
design, so the first journal commit after mount oopses in
__bh_submit(), kjournald2 is killed by make_task_dead() and every
subsequent metadata write blocks forever - journald, the flush workers
and eventually all of userspace wedge in uninterruptible sleep with no
block-layer errors reported. After an unclean shutdown the crash moves
into early boot (journal recovery commits immediately), which makes
the machine effectively unbootable until a different kernel is chosen.

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
CPU: 0 UID: 0 PID: 357 Comm: jbd2/nvme0n1p18 Tainted: G W 7.3.0-rc1-next-20260831
pc : __bh_submit+0xa8/0x210
Call trace:
__bh_submit+0xa8/0x210 (P)
bh_submit+0x24/0x38
jbd2_journal_commit_transaction+0xb80/0x1ce8
kjournald2+0xb8/0x238

With this exact change applied on top of next-20260831 the same
machine (ASUS Zenbook A16 UX3607OA, Snapdragon X2 Elite, arm64) boots
reliably and has been running normally for 11+ hours.

Tested-by: Greg Ociepka <greg@xxxxxxxxxxxxx>