Re: [syzbot] [ext4?] BUG: unable to handle kernel NULL pointer dereference in strrchr

From: Jan Kara

Date: Fri Nov 20 2026 - 08:07:36 EST


On Fri 20-11-26 04:49:43, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 65e4fd942f72 Merge tag 'selinux-pr-20261119' of git://git...
> git tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
> console output: https://syzkaller.appspot.com/x/log.txt?x=1102b185580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=3299dd89908ef903
> dashboard link: https://syzkaller.appspot.com/bug?extid=1d23ad199a3bfd6f9149
> compiler: arm-linux-gnueabi-gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
> userspace arch: arm
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=165e3abd580000
>
> The issue was bisected by AI to:
>
> commit 98f18c76c2c3089183c35d2c33e468ad6c03d86b
> Author: Eric Sandeen <sandeen@xxxxxxxxxx>
> Date: Sun Feb 23 19:57:41 2025 +0000
>
> ext2: create ext2_msg_fc for use during parsing
>
> AI reasoning: https://syzkaller.appspot.com/ai_job?id=f0a661eb-7c3b-44be-becd-54ce0bd776b2
>
> AI-generated root cause summary:
> In fs/ext2/super.c, ext2_msg_fc() formats log messages for filesystem context
> operations. When fc->purpose != FS_CONTEXT_FOR_RECONFIGURE, it unconditionally
> executes strrchr(fc->source, '/') without verifying that fc->source is non-NULL.
> During filesystem configuration via the new mount API (e.g., fsopen() followed
> by fsconfig()), fc->source starts as NULL and options can be parsed in any
> order. Specifying an option that triggers ext2_msg_fc() (such as "dax", "nobh",
> or "reservation") prior to supplying the "source" parameter passes a NULL
> pointer to strrchr(), causing a kernel NULL pointer dereference.

Yeah, correct. I'm putting attached patch to my tree.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR