Re: [PATCH] ntfs3: avoid freeing the primary MFT record during attribute list removal

From: Shuai Liu

Date: Thu Dec 03 2026 - 10:45:27 EST


Hi Aibing,

I verified this patch against the syzbot report [1] on top of master
commit d06ce6f1eb5ee, using the syzbot kernel configuration
(CONFIG_KASAN=y with KASAN_INLINE, CONFIG_PROVE_LOCKING=y) and the
syzbot C reproducer running in QEMU.

Baseline (unpatched), reproduced twice:

BUG: KASAN: slab-use-after-free in ntfs_read_hdr+0xa1f/0xb70
Freed by task ...:
kfree
ni_write_inode <- inlined ni_try_remove_attr_list()
__writeback_single_inode
write_inode_now
ntfs_file_fsync

which matches the syzbot report: the free comes from the error path of
ni_try_remove_attr_list() during writeback while ntfs_readdir() walks
the root index header with ni_lock already dropped (7a5aa6c45072).

With this patch applied, two consecutive runs of the reproducer are
clean: the error path still executes (restore path reached), the
primary record buffer stays alive, and no KASAN report appears.

Thanks,
Shuai Liu

[1] https://syzkaller.appspot.com/bug?extid=7f14bc1da1f4da6518e5