================================================================== BUG: KASAN: use-after-free in ntfs_write_bh+0x6b9/0x6e0 fs/ntfs3/fsntfs.c:1401 Read of size 8 at addr ffff8880338b4000 by task syz-executor.2/32201 CPU: 3 PID: 32201 Comm: syz-executor.2 Not tainted 6.6.0-rc1-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 ntfs_write_bh+0x6b9/0x6e0 fs/ntfs3/fsntfs.c:1401 mi_write+0xc0/0x1e0 fs/ntfs3/record.c:346 ni_write_inode+0x102c/0x2810 fs/ntfs3/frecord.c:3360 write_inode fs/fs-writeback.c:1456 [inline] __writeback_single_inode+0xa81/0xe70 fs/fs-writeback.c:1668 writeback_single_inode+0x2af/0x590 fs/fs-writeback.c:1724 sync_inode_metadata+0xa5/0xe0 fs/fs-writeback.c:2786 ntfs_set_state+0x3f0/0x6e0 fs/ntfs3/fsntfs.c:995 ntfs_create_inode+0x317/0x4290 fs/ntfs3/inode.c:1307 ntfs_atomic_open+0x4d2/0x650 fs/ntfs3/namei.c:422 atomic_open fs/namei.c:3358 [inline] lookup_open.isra.0+0xc44/0x1360 fs/namei.c:3466 open_last_lookups fs/namei.c:3563 [inline] path_openat+0x931/0x29c0 fs/namei.c:3793 do_filp_open+0x1de/0x430 fs/namei.c:3823 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_openat fs/open.c:1453 [inline] __se_sys_openat fs/open.c:1448 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1448 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fa5d1e7cae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa5d2c240c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007fa5d1f9bf80 RCX: 00007fa5d1e7cae9 RDX: 000000000000275a RSI: 0000000020000040 RDI: ffffffffffffff9c RBP: 00007fa5d1ec847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fa5d1f9bf80 R15: 00007ffdf4142f98 The buggy address belongs to the physical page: page:ffffea0000ce2d00 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0 pfn:0x338b4 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffff7f(buddy) raw: 00fff00000000000 ffffea0000c94408 ffffea00008c5f88 0000000000000000 raw: 0000000000000000 0000000000000001 00000000ffffff7f 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 1, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 4641, tgid 4641 (udevd), ts 639587101669, free_ts 640362084141 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages_slowpath.constprop.0+0x2dd/0x2360 mm/page_alloc.c:3960 __alloc_pages+0x411/0x4a0 mm/page_alloc.c:4439 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x99/0x3a0 mm/slab.c:2550 cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] slab_alloc mm/slab.c:3246 [inline] __kmem_cache_alloc_lru mm/slab.c:3423 [inline] kmem_cache_alloc+0x3a6/0x400 mm/slab.c:3432 getname_flags.part.0+0x50/0x4d0 fs/namei.c:140 getname_flags+0x9c/0xf0 include/linux/audit.h:321 user_path_at_empty+0x2c/0x60 fs/namei.c:2909 do_readlinkat+0xdd/0x2f0 fs/stat.c:533 __do_sys_readlink fs/stat.c:566 [inline] __se_sys_readlink fs/stat.c:563 [inline] __x64_sys_readlink+0x78/0xb0 fs/stat.c:563 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405 slab_destroy mm/slab.c:1608 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1628 cache_flusharray mm/slab.c:3341 [inline] ___cache_free+0x2b7/0x420 mm/slab.c:3404 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x4c/0x1b0 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18b/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slab.c:3237 [inline] slab_alloc mm/slab.c:3246 [inline] __kmem_cache_alloc_lru mm/slab.c:3423 [inline] kmem_cache_alloc_lru+0x1ff/0x680 mm/slab.c:3439 alloc_inode_sb include/linux/fs.h:2909 [inline] sock_alloc_inode+0x25/0x1c0 net/socket.c:308 alloc_inode+0x5d/0x220 fs/inode.c:259 new_inode_pseudo+0x16/0x80 fs/inode.c:1004 sock_alloc+0x40/0x270 net/socket.c:634 __sock_create+0xbc/0x810 net/socket.c:1516 sock_create net/socket.c:1603 [inline] __sys_socket_create net/socket.c:1640 [inline] __sys_socket+0x14c/0x260 net/socket.c:1691 __do_sys_socket net/socket.c:1705 [inline] __se_sys_socket net/socket.c:1703 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1703 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 Memory state around the buggy address: ffff8880338b3f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880338b3f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880338b4000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880338b4080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880338b4100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================