CVE: CVE-2025-37806
Published: 2025-05-08
Description: In the Linux kernel, the following vulnerability has been resolved:

fs/ntfs3: Keep write operations atomic

syzbot reported a NULL pointer dereference in __generic_file_write_iter. [1]

Before the write operation is completed, the user executes ioctl[2] to clear
the compress flag of the file, which causes the is_compressed() judgment to
return 0, further causing the program to enter the wrong process and call the
wrong ops ntfs_aops_cmpr, which triggers the null pointer dereference of
write_begin.

Use inode lock to synchronize ioctl and write to avoid this case.

[1]
Unable to handle kernel NULL pointer dereference at virtual address [PII_REDACTED]
Mem abort info:
  ESR = 0x[PII_REDACTED]000006
  EC = 0x21: IABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x06: level 2 translation fault
user pgtable: 4k pages, 48-bit VAs, pgdp=[PII_REDACTED]96d000
[[PII_REDACTED]] pgd=[PII_REDACTED]b44403, p4d=[PII_REDACTED]b44403, pud=[PII_REDACTED], pmd=[PII_REDACTED]
Internal error: Oops: [PII_REDACTED] [#1] PREEMPT SMP
Modules linked in:
CPU: 0 UID: 0 PID: 6427 Comm: syz-executor347 Not tainted 6.13.0-rc3-syzkaller-g573067a5a685 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : 0x0
lr : generic_perform_write+0x29c/0x868 mm/filemap.c:4055
sp : ffff80009d4978a0
x29: ffff80009d4979c0 x28: dfff[PII_REDACTED]00 x27: ffff80009d497bc8
x26: [PII_REDACTED] x25: ffff80009d497960 x24: ffff80008ba71c68
x23: [PII_REDACTED] x22: ffff0000c655dac0 x21: [PII_REDACTED]
x20:[PII_REDACTED]00000c x19: 1ffff00013a92f2c x18: ffff0000e183aa1c
x17: [PII_REDACTED] x16: ffff[PII_REDACTED]34 x15: [PII_REDACTED]
x14: [PII_REDACTED] x13: [PII_REDACTED] x12: ffff0000c655dac0
x11:[PII_REDACTED]ff0100 x10:[PII_REDACTED]ff0100 x9 : [PII_REDACTED]
x8 : [PII_REDACTED] x7 : [PII_REDACTED] x6 : [PII_REDACTED]
x5 : ffff80009d497980 x4 : ffff80009d497960 x3 : [PII_REDACTED]
x2 : [PII_REDACTED] x1 : ffff0000e183a928 x0 : ffff0000d60b0fc0
Call trace:
 0x0 (P)
 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4156
 ntfs_file_write_iter+0x54c/0x630 fs/ntfs3/file.c:1267
 new_sync_write fs/read_write.c:586 [inline]
 vfs_write+0x920/0xcf4 fs/read_write.c:679
 ksys_write+0x15c/0x26c fs/read_write.c:731
 __do_sys_write fs/read_write.c:742 [inline]
 __se_sys_write fs/read_write.c:739 [inline]
 __arm64_sys_write+0x7c/0x90 fs/read_write.c:739
 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151
 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744
 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762

[2]
ioctl$FS_IOC_SETFLAGS(r0, 0x40086602, &(0x7f00000000c0)=0x20)
CVSS Score: 5.5 (MEDIUM)
CWE: CWE-476
References: https://git.kernel.org/stable/c/285cec318bf5a7a6c8ba999b2b6ec96f9a20590f; https://git.kernel.org/stable/c/464139e18f619aa14fb921a61721862f43421c54; https://git.kernel.org/stable/c/8db49e89a7f8b48ee59fa9ad32b6ed0879747df8