================================================================== BUG: KASAN: double-free or invalid-free in snd_seq_port_disconnect+0x4c1/0x5c0 sound/core/seq/seq_ports.c:614 CPU: 0 PID: 7299 Comm: syz-executor.0 Not tainted 5.8.0-rc7-next-20200731-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+0x18f/0x20d lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383 kasan_report_invalid_free+0x51/0x80 mm/kasan/report.c:477 __kasan_slab_free+0x107/0x120 mm/kasan/common.c:401 __cache_free mm/slab.c:3418 [inline] kfree+0x103/0x2c0 mm/slab.c:3756 snd_seq_port_disconnect+0x4c1/0x5c0 sound/core/seq/seq_ports.c:614 snd_seq_ioctl_unsubscribe_port+0x1fc/0x400 sound/core/seq/seq_clientmgr.c:1525 snd_seq_kernel_client_ctl+0xeb/0x130 sound/core/seq/seq_clientmgr.c:2353 snd_seq_oss_midi_close+0x36e/0x4d0 sound/core/seq/oss/seq_oss_midi.c:405 snd_seq_oss_synth_reset+0x418/0x860 sound/core/seq/oss/seq_oss_synth.c:406 snd_seq_oss_reset+0x6f/0x290 sound/core/seq/oss/seq_oss_init.c:435 snd_seq_oss_ioctl+0xb7b/0xd40 sound/core/seq/oss/seq_oss_ioctl.c:93 odev_ioctl+0x4f/0x90 sound/core/seq/oss/seq_oss.c:174 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x45cce9 Code: 2d b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 fb b5 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f8ac4a9ac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00000000000154c0 RCX: 000000000045cce9 RDX: 0000000000000000 RSI: 0000000000005100 RDI: 0000000000000003 RBP: 000000000078bfd8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000078bfac R13: 00007ffe1d85ce3f R14: 00007f8ac4a9b9c0 R15: 000000000078bfac Allocated by task 7298: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461 kmem_cache_alloc_trace+0x16e/0x2c0 mm/slab.c:3550 kmalloc include/linux/slab.h:554 [inline] kzalloc include/linux/slab.h:666 [inline] snd_seq_port_connect+0x5d/0x520 sound/core/seq/seq_ports.c:553 snd_seq_ioctl_subscribe_port+0x1fc/0x400 sound/core/seq/seq_clientmgr.c:1484 snd_seq_kernel_client_ctl+0xeb/0x130 sound/core/seq/seq_clientmgr.c:2353 snd_seq_oss_midi_open+0x466/0x6e0 sound/core/seq/oss/seq_oss_midi.c:364 snd_seq_oss_synth_setup_midi+0x123/0x520 sound/core/seq/oss/seq_oss_synth.c:269 snd_seq_oss_open+0x87e/0xa10 sound/core/seq/oss/seq_oss_init.c:261 odev_open+0x6c/0x90 sound/core/seq/oss/seq_oss.c:125 soundcore_open+0x445/0x600 sound/sound_core.c:593 chrdev_open+0x266/0x770 fs/char_dev.c:414 do_dentry_open+0x4b9/0x11b0 fs/open.c:827 do_open fs/namei.c:3249 [inline] path_openat+0x1b9a/0x2730 fs/namei.c:3366 do_filp_open+0x17e/0x3c0 fs/namei.c:3393 do_sys_openat2+0x16d/0x420 fs/open.c:1178 do_sys_open fs/open.c:1194 [inline] __do_sys_openat fs/open.c:1210 [inline] __se_sys_openat fs/open.c:1205 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1205 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 7298: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355 __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422 __cache_free mm/slab.c:3418 [inline] kfree+0x103/0x2c0 mm/slab.c:3756 snd_seq_port_disconnect+0x4c1/0x5c0 sound/core/seq/seq_ports.c:614 snd_seq_ioctl_unsubscribe_port+0x1fc/0x400 sound/core/seq/seq_clientmgr.c:1525 snd_seq_kernel_client_ctl+0xeb/0x130 sound/core/seq/seq_clientmgr.c:2353 snd_seq_oss_midi_close+0x36e/0x4d0 sound/core/seq/oss/seq_oss_midi.c:405 snd_seq_oss_synth_reset+0x418/0x860 sound/core/seq/oss/seq_oss_synth.c:406 snd_seq_oss_reset+0x6f/0x290 sound/core/seq/oss/seq_oss_init.c:435 snd_seq_oss_ioctl+0xb7b/0xd40 sound/core/seq/oss/seq_oss_ioctl.c:93 odev_ioctl+0x4f/0x90 sound/core/seq/oss/seq_oss.c:174 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff88809062d000 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 0 bytes inside of 128-byte region [ffff88809062d000, ffff88809062d080) The buggy address belongs to the page: page:0000000077ab10bd refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9062d flags: 0xfffe0000000200(slab) raw: 00fffe0000000200 ffffea00024099c8 ffffea0002914e08 ffff8880aa000400 raw: 0000000000000000 ffff88809062d000 0000000100000010 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88809062cf00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88809062cf80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc >ffff88809062d000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88809062d080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88809062d100: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================