================================================================== BUG: KASAN: double-free in hfsplus_release_folio+0x28d/0x5f0 fs/hfsplus/inode.c:103 Free of addr ffff88801e2c5800 by task syz-fuzzer/5394 CPU: 2 PID: 5394 Comm: syz-fuzzer Not tainted 6.3.0-syzkaller-10620-g33afd4b76393 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report_invalid_free+0xe8/0x100 mm/kasan/report.c:537 ____kasan_slab_free+0x160/0x1a0 mm/kasan/common.c:225 kasan_slab_free include/linux/kasan.h:162 [inline] __cache_free mm/slab.c:3389 [inline] __do_kmem_cache_free mm/slab.c:3576 [inline] __kmem_cache_free+0xcd/0x2c0 mm/slab.c:3583 hfsplus_release_folio+0x28d/0x5f0 fs/hfsplus/inode.c:103 filemap_release_folio+0x13f/0x1b0 mm/filemap.c:4118 shrink_folio_list+0x1fe3/0x3c80 mm/vmscan.c:2066 evict_folios+0x794/0x1940 mm/vmscan.c:5147 try_to_shrink_lruvec+0x82c/0xb90 mm/vmscan.c:5323 shrink_one+0x462/0x710 mm/vmscan.c:5367 shrink_many mm/vmscan.c:5419 [inline] lru_gen_shrink_node mm/vmscan.c:5536 [inline] shrink_node+0x1fd5/0x3500 mm/vmscan.c:6477 shrink_zones mm/vmscan.c:6726 [inline] do_try_to_free_pages+0x3b4/0x17b0 mm/vmscan.c:6788 try_to_free_pages+0x2ab/0x710 mm/vmscan.c:7023 __perform_reclaim mm/page_alloc.c:3960 [inline] __alloc_pages_direct_reclaim mm/page_alloc.c:3982 [inline] __alloc_pages_slowpath.constprop.0+0x808/0x2170 mm/page_alloc.c:4387 __alloc_pages+0x408/0x4a0 mm/page_alloc.c:4772 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2277 folio_alloc+0x20/0x70 mm/mempolicy.c:2287 filemap_alloc_folio+0x3c1/0x470 mm/filemap.c:976 page_cache_ra_unbounded+0x1ae/0x5e0 mm/readahead.c:248 do_page_cache_ra mm/readahead.c:300 [inline] page_cache_ra_order+0x6ec/0xa00 mm/readahead.c:560 do_sync_mmap_readahead mm/filemap.c:3187 [inline] filemap_fault+0x140a/0x24a0 mm/filemap.c:3279 __do_fault+0x107/0x600 mm/memory.c:4176 do_read_fault mm/memory.c:4530 [inline] do_fault mm/memory.c:4659 [inline] do_pte_missing mm/memory.c:3647 [inline] handle_pte_fault mm/memory.c:4947 [inline] __handle_mm_fault+0x27f6/0x4170 mm/memory.c:5089 handle_mm_fault+0x2af/0x9f0 mm/memory.c:5243 do_user_addr_fault+0x51a/0x1210 arch/x86/mm/fault.c:1440 handle_page_fault arch/x86/mm/fault.c:1534 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1590 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0033:0x57eee0 Code: 89 44 24 08 e8 21 88 ee ff 48 8b 44 24 08 e9 d7 fe ff ff cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc <49> 3b 66 10 0f 86 cb 03 00 00 48 83 ec 38 48 89 6c 24 30 48 8d 6c RSP: 002b:000000c0000197f0 EFLAGS: 00010202 RAX: 000000c000292060 RBX: 000000c00e30a050 RCX: 0000000000000000 RDX: 000000c000292060 RSI: 00000000008e9060 RDI: 000000c000019d80 RBP: 000000c000019810 R08: 0000000000000000 R09: 000000c0000198d8 R10: 000000c010828a5b R11: aaaaaa1313001313 R12: 0000000000000000 R13: 0000000000000000 R14: 000000c000cd01a0 R15: 0000000000010000 Allocated by task 24077: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] ____kasan_kmalloc mm/kasan/common.c:333 [inline] __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc+0x5e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] kzalloc include/linux/slab.h:680 [inline] __hfs_bnode_create+0x107/0x840 fs/hfsplus/bnode.c:409 hfsplus_bnode_find+0x41c/0xc60 fs/hfsplus/bnode.c:486 hfsplus_brec_find+0x2b3/0x520 fs/hfsplus/bfind.c:183 hfsplus_brec_read+0x2c/0x120 fs/hfsplus/bfind.c:222 hfsplus_find_cat+0x1d4/0x4c0 fs/hfsplus/catalog.c:202 hfsplus_iget+0x480/0x7c0 fs/hfsplus/super.c:82 hfsplus_fill_super+0xc86/0x1c40 fs/hfsplus/super.c:503 mount_bdev+0x357/0x420 fs/super.c:1380 legacy_get_tree+0x109/0x220 fs/fs_context.c:610 vfs_get_tree+0x8d/0x350 fs/super.c:1510 do_new_mount fs/namespace.c:3039 [inline] path_mount+0x134b/0x1e40 fs/namespace.c:3369 do_mount fs/namespace.c:3382 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x283/0x300 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5149: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] __cache_free mm/slab.c:3389 [inline] __do_kmem_cache_free mm/slab.c:3576 [inline] __kmem_cache_free+0xcd/0x2c0 mm/slab.c:3583 hfsplus_btree_close+0xab/0x390 fs/hfsplus/btree.c:275 hfsplus_put_super+0x24c/0x3f0 fs/hfsplus/super.c:301 generic_shutdown_super+0x158/0x480 fs/super.c:500 kill_block_super+0xa1/0x100 fs/super.c:1407 deactivate_locked_super+0x98/0x160 fs/super.c:331 deactivate_super+0xb1/0xd0 fs/super.c:362 cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1177 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0x7b/0x90 mm/kasan/generic.c:491 insert_work+0x48/0x350 kernel/workqueue.c:1361 __queue_work+0x625/0x1120 kernel/workqueue.c:1524 queue_work_on+0xf2/0x110 kernel/workqueue.c:1552 queue_work include/linux/workqueue.h:504 [inline] snd_virmidi_output_trigger+0xf1/0x130 sound/core/seq/seq_virmidi.c:171 snd_rawmidi_output_trigger sound/core/rawmidi.c:201 [inline] snd_rawmidi_output_trigger sound/core/rawmidi.c:197 [inline] snd_rawmidi_kernel_write1+0x53d/0x850 sound/core/rawmidi.c:1563 snd_rawmidi_write+0x277/0xbb0 sound/core/rawmidi.c:1616 vfs_write+0x2e4/0xe10 fs/read_write.c:582 ksys_write+0x1ec/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0x7b/0x90 mm/kasan/generic.c:491 insert_work+0x48/0x350 kernel/workqueue.c:1361 __queue_work+0x625/0x1120 kernel/workqueue.c:1524 queue_work_on+0xf2/0x110 kernel/workqueue.c:1552 queue_work include/linux/workqueue.h:504 [inline] snd_virmidi_output_trigger+0xf1/0x130 sound/core/seq/seq_virmidi.c:171 snd_rawmidi_output_trigger sound/core/rawmidi.c:201 [inline] snd_rawmidi_output_trigger sound/core/rawmidi.c:197 [inline] snd_rawmidi_kernel_write1+0x53d/0x850 sound/core/rawmidi.c:1563 snd_rawmidi_write+0x277/0xbb0 sound/core/rawmidi.c:1616 vfs_write+0x2e4/0xe10 fs/read_write.c:582 ksys_write+0x1ec/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88801e2c5800 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 0 bytes inside of 192-byte region [ffff88801e2c5800, ffff88801e2c58c0) The buggy address belongs to the physical page: page:ffffea000078b140 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1e2c5 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x10() raw: 00fff00000000200 ffff888012440000 ffffea0000773290 ffffea000072af10 raw: 0000000000000000 ffff88801e2c5000 0000000100000010 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x242000(__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 6, tgid 6 (kworker/0:0), ts 808600344982, free_ts 808586329102 prep_new_page mm/page_alloc.c:1729 [inline] get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3493 __alloc_pages_slowpath.constprop.0+0x2e7/0x2170 mm/page_alloc.c:4293 __alloc_pages+0x408/0x4a0 mm/page_alloc.c:4772 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1360 [inline] cache_grow_begin+0x9b/0x3b0 mm/slab.c:2569 cache_alloc_refill+0x27f/0x380 mm/slab.c:2942 ____cache_alloc mm/slab.c:3018 [inline] ____cache_alloc mm/slab.c:3001 [inline] __do_cache_alloc mm/slab.c:3201 [inline] slab_alloc_node mm/slab.c:3249 [inline] __kmem_cache_alloc_node+0x360/0x3f0 mm/slab.c:3540 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc+0x4e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] bio_kmalloc+0x41/0x70 block/bio.c:605 bio_copy_kern block/blk-map.c:485 [inline] blk_rq_map_kern+0x40a/0x7a0 block/blk-map.c:791 scsi_execute_cmd+0x59a/0x760 drivers/scsi/scsi_lib.c:223 sr_get_events drivers/scsi/sr.c:178 [inline] sr_check_events+0x1d1/0xa90 drivers/scsi/sr.c:218 cdrom_update_events drivers/cdrom/cdrom.c:1485 [inline] cdrom_check_events+0x63/0x110 drivers/cdrom/cdrom.c:1495 sr_block_check_events+0xc3/0x100 drivers/scsi/sr.c:562 disk_check_events+0xc2/0x420 block/disk-events.c:193 process_one_work+0x991/0x15c0 kernel/workqueue.c:2390 worker_thread+0x669/0x1090 kernel/workqueue.c:2537 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x629/0xca0 mm/page_alloc.c:2555 free_unref_page+0x33/0x370 mm/page_alloc.c:2650 skb_free_frag include/linux/skbuff.h:3229 [inline] skb_free_head+0xa6/0x1b0 net/core/skbuff.c:916 skb_release_data+0x598/0x820 net/core/skbuff.c:948 skb_release_all net/core/skbuff.c:1014 [inline] __kfree_skb+0x51/0x70 net/core/skbuff.c:1028 tcp_rcv_established+0x1327/0x1f90 net/ipv4/tcp_input.c:5929 tcp_v4_do_rcv+0x65a/0x9c0 net/ipv4/tcp_ipv4.c:1721 sk_backlog_rcv include/net/sock.h:1113 [inline] __release_sock+0x133/0x3b0 net/core/sock.c:2917 release_sock+0x58/0x1b0 net/core/sock.c:3484 tcp_sendmsg+0x3a/0x50 net/ipv4/tcp.c:1486 inet_sendmsg+0x9d/0xe0 net/ipv4/af_inet.c:825 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg+0xde/0x190 net/socket.c:747 sock_write_iter+0x295/0x3d0 net/socket.c:1140 call_write_iter include/linux/fs.h:1854 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9ee/0xe10 fs/read_write.c:584 ksys_write+0x1ec/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 Memory state around the buggy address: ffff88801e2c5700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88801e2c5780: 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88801e2c5800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801e2c5880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88801e2c5900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================