================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3e7f/0x5660 kernel/locking/lockdep.c:4926 Read of size 8 at addr ffff88813fe81468 by task syz-executor117/5072 CPU: 0 PID: 5072 Comm: syz-executor117 Not tainted 6.2.0-rc3-next-20230112-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x45d mm/kasan/report.c:417 kasan_report+0xc0/0xf0 mm/kasan/report.c:517 __lock_acquire+0x3e7f/0x5660 kernel/locking/lockdep.c:4926 lock_acquire.part.0+0x11a/0x350 kernel/locking/lockdep.c:5669 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162 remove_wait_queue+0x21/0x180 kernel/sched/wait.c:54 snd_rawmidi_write+0x48d/0xbb0 sound/core/rawmidi.c:1604 vfs_write+0x2db/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 RIP: 0033:0x7f588365eb79 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f588360c308 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f58836e2428 RCX: 00007f588365eb79 RDX: 00000000fffffd2c RSI: 0000000020000000 RDI: 0000000000000004 RBP: 00007f58836e2420 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f58836b0004 R13: 00007ffcbc1a08bf R14: 00007f588360c400 R15: 0000000000022000 Allocated by task 5072: 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:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:380 kmalloc include/linux/slab.h:580 [inline] kzalloc include/linux/slab.h:720 [inline] snd_rawmidi_runtime_create sound/core/rawmidi.c:164 [inline] open_substream+0xe9/0x8c0 sound/core/rawmidi.c:341 rawmidi_open_priv+0x591/0x6f0 sound/core/rawmidi.c:394 snd_rawmidi_open+0x467/0xb70 sound/core/rawmidi.c:492 snd_open+0x223/0x460 sound/core/sound.c:169 chrdev_open+0x26a/0x770 fs/char_dev.c:414 do_dentry_open+0x6cc/0x13f0 fs/open.c:883 do_open fs/namei.c:3558 [inline] path_openat+0x1bc1/0x2b40 fs/namei.c:3715 do_filp_open+0x1ba/0x410 fs/namei.c:3742 do_sys_openat2+0x16d/0x4c0 fs/open.c:1311 do_sys_open fs/open.c:1327 [inline] __do_sys_openat fs/open.c:1343 [inline] __se_sys_openat fs/open.c:1338 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1338 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 5074: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:518 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807 slab_free mm/slub.c:3787 [inline] __kmem_cache_free+0xaf/0x2d0 mm/slub.c:3800 snd_rawmidi_runtime_free sound/core/rawmidi.c:192 [inline] close_substream.part.0+0x21d/0x850 sound/core/rawmidi.c:570 close_substream sound/core/rawmidi.c:544 [inline] rawmidi_release_priv+0x192/0x270 sound/core/rawmidi.c:587 snd_rawmidi_release+0x62/0xf0 sound/core/rawmidi.c:618 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 get_signal+0x1c7/0x24f0 kernel/signal.c:2635 arch_do_signal_or_restart+0x79/0x5c0 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x11f/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 The buggy address belongs to the object at ffff88813fe81400 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 104 bytes inside of 256-byte region [ffff88813fe81400, ffff88813fe81500) The buggy address belongs to the physical page: page:ffffea0004ffa000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x13fe80 head:ffffea0004ffa000 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x17ff00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff) raw: 017ff00000010200 ffff888012441b40 dead000000000100 dead000000000122 raw: 0000000000000000 0000000080100010 00000001ffffffff 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 0x0(), pid 1, tgid 1 (swapper/0), ts 2032443418, free_ts 0 create_dummy_stack mm/page_owner.c:67 [inline] register_early_stack+0x65/0xa4 mm/page_owner.c:83 init_page_owner+0x5a/0x636 mm/page_owner.c:93 invoke_init_callbacks mm/page_ext.c:126 [inline] page_ext_init+0x45d/0x46d mm/page_ext.c:518 kernel_init_freeable+0x4c4/0x782 init/main.c:1632 page_owner free stack trace missing Memory state around the buggy address: ffff88813fe81300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88813fe81380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88813fe81400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88813fe81480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88813fe81500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================