================================================================== BUG: KASAN: use-after-free in snd_card_do_free sound/core/init.c:604 [inline] BUG: KASAN: use-after-free in release_card_device+0x17d/0x1a0 sound/core/init.c:153 Read of size 1 at addr ffff88804b714909 by task syz.2.1751/14095 CPU: 3 UID: 0 PID: 14095 Comm: syz.2.1751 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 snd_card_do_free sound/core/init.c:604 [inline] release_card_device+0x17d/0x1a0 sound/core/init.c:153 device_release+0xd2/0x270 drivers/base/core.c:2636 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1f7/0x640 lib/kobject.c:737 put_device+0x1f/0x30 drivers/base/core.c:3880 snd_card_file_remove+0x38f/0x560 sound/core/init.c:1125 snd_pcm_oss_release+0x217/0x300 sound/core/oss/pcm_oss.c:2596 __fput+0x3ff/0xb50 fs/file_table.c:512 task_work_run+0x150/0x240 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:70 [inline] exit_to_user_mode_loop+0x1d8/0x6f0 kernel/entry/common.c:101 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline] __do_fast_syscall_32+0x701/0x970 arch/x86/entry/syscall_32.c:310 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7f22fec Code: Unable to access opcode bytes at 0xf7f22fc2. RSP: 002b:00000000ff95f99c EFLAGS: 00000202 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 0000000000000003 RCX: 000000000000001e RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4b714 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000000000 ffffea00010c6b08 ffff88802b3417c0 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x40dc0(GFP_KERNEL|__GFP_ZERO|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 17283626616, free_ts 320704983431 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304 alloc_pages_mpol+0x1fb/0x540 mm/mempolicy.c:2490 ___kmalloc_large_node+0xe5/0x120 mm/slub.c:5274 __kmalloc_large_node_noprof+0x1c/0x70 mm/slub.c:5305 __do_kmalloc_node mm/slub.c:5322 [inline] __kmalloc_node_track_caller_noprof+0x5ac/0x830 mm/slub.c:5471 alloc_dr drivers/base/devres.c:141 [inline] __devres_alloc_node+0x6e/0x1e0 drivers/base/devres.c:189 snd_devm_card_new+0x9d/0x190 sound/core/init.c:235 loopback_probe+0x140/0x11a0 sound/drivers/aloop.c:1805 platform_probe+0x106/0x1d0 drivers/base/platform.c:1439 call_driver_probe drivers/base/dd.c:628 [inline] really_probe+0x241/0xa60 drivers/base/dd.c:706 __driver_probe_device+0x20e/0x450 drivers/base/dd.c:868 driver_probe_device+0x4a/0x140 drivers/base/dd.c:898 __device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500 page last free pid 14119 tgid 14118 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1406 [inline] __free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950 free_node drivers/base/devres.c:50 [inline] release_nodes+0xc3/0x120 drivers/base/devres.c:547 devres_release_all+0x112/0x180 drivers/base/devres.c:576 device_unbind_cleanup+0x81/0x270 drivers/base/dd.c:597 __device_release_driver drivers/base/dd.c:1354 [inline] device_release_driver_internal+0x4c4/0x620 drivers/base/dd.c:1372 unbind_store+0xf8/0x110 drivers/base/bus.c:244 drv_attr_store+0x74/0xb0 drivers/base/bus.c:125 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145 kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x6ac/0x1050 fs/read_write.c:687 ksys_write+0x12a/0x250 fs/read_write.c:739 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Memory state around the buggy address: ffff88804b714800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804b714880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88804b714900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88804b714980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804b714a00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================