================================================================== BUG: KASAN: use-after-free in _copy_from_user+0xef/0x140 lib/usercopy.c:12 Write of size 32 at addr ffff8880a534b3a0 by task syz-executor745/6430 CPU: 1 PID: 6430 Comm: syz-executor745 Not tainted 4.19.115-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x188/0x20d lib/dump_stack.c:118 print_address_description.cold+0x7c/0x212 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report mm/kasan/report.c:412 [inline] kasan_report.cold+0x88/0x2b9 mm/kasan/report.c:396 _copy_from_user+0xef/0x140 lib/usercopy.c:12 copy_from_user include/linux/uaccess.h:147 [inline] snd_rawmidi_kernel_write1+0x301/0x6c0 sound/core/rawmidi.c:1282 snd_rawmidi_write+0x2e4/0xb50 sound/core/rawmidi.c:1348 __vfs_write+0xf7/0x760 fs/read_write.c:485 vfs_write+0x206/0x550 fs/read_write.c:549 ksys_write+0x12b/0x2a0 fs/read_write.c:599 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x44a3f9 Code: e8 5c b3 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 0f 83 2b cc fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f571e99bdb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 000000000044a3f9 RDX: 0000000020000339 RSI: 00000000200001c0 RDI: 0000000000000003 RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c R13: 00007fff8662259f R14: 00007f571e99c9c0 R15: 20c49ba5e353f7cf Allocated by task 6430: set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc mm/kasan/kasan.c:553 [inline] kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531 __do_kmalloc_node mm/slab.c:3689 [inline] __kmalloc_node+0x4c/0x70 mm/slab.c:3696 kmalloc_node include/linux/slab.h:557 [inline] kvmalloc_node+0x61/0xf0 mm/util.c:423 kvmalloc include/linux/mm.h:577 [inline] kvzalloc include/linux/mm.h:585 [inline] snd_rawmidi_runtime_create sound/core/rawmidi.c:133 [inline] open_substream+0x332/0x800 sound/core/rawmidi.c:277 rawmidi_open_priv+0x58e/0x6e0 sound/core/rawmidi.c:328 snd_rawmidi_open+0x449/0xaf0 sound/core/rawmidi.c:425 snd_open+0x212/0x3e2 sound/core/sound.c:175 chrdev_open+0x219/0x5c0 fs/char_dev.c:423 do_dentry_open+0x4a8/0x1160 fs/open.c:796 do_last fs/namei.c:3421 [inline] path_openat+0x1031/0x4200 fs/namei.c:3537 do_filp_open+0x1a1/0x280 fs/namei.c:3567 do_sys_open+0x3c0/0x500 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 6431: set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0xf7/0x140 mm/kasan/kasan.c:521 __cache_free mm/slab.c:3503 [inline] kfree+0xce/0x220 mm/slab.c:3822 kvfree+0x59/0x60 mm/util.c:452 resize_runtime_buffer+0x29e/0x370 sound/core/rawmidi.c:669 snd_rawmidi_output_params+0x128/0x170 sound/core/rawmidi.c:682 snd_rawmidi_ioctl+0x640/0x740 sound/core/rawmidi.c:759 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xcda/0x12e0 fs/ioctl.c:688 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880a534a640 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 3424 bytes inside of 4096-byte region [ffff8880a534a640, ffff8880a534b640) The buggy address belongs to the page: page:ffffea000294d280 count:1 mapcount:0 mapping:ffff88812c3dcdc0 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffffea0002942988 ffffea0002920208 ffff88812c3dcdc0 raw: 0000000000000000 ffff8880a534a640 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a534b280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a534b300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880a534b380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880a534b400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a534b480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================