================================================================== BUG: KASAN: slab-use-after-free in __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:155 [inline] BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:181 Read of size 1 at addr ffff8880622f4418 by task kworker/0:3/2395 CPU: 0 UID: 0 PID: 2395 Comm: kworker/0:3 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Workqueue: usb_hub_wq hub_event 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 __kasan_check_byte+0x36/0x50 mm/kasan/common.c:585 kasan_check_byte include/linux/kasan.h:402 [inline] lock_acquire kernel/locking/lockdep.c:5916 [inline] lock_acquire+0x132/0x380 kernel/locking/lockdep.c:5899 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:155 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:181 p9_tag_remove net/9p/client.c:274 [inline] p9_req_put net/9p/client.c:282 [inline] p9_req_put+0xaf/0x250 net/9p/client.c:279 req_done+0x1dc/0x2e0 net/9p/trans_virtio.c:147 vring_interrupt+0x2ef/0x660 drivers/virtio/virtio_ring.c:3335 __handle_irq_event_percpu+0x232/0x880 kernel/irq/handle.c:209 handle_irq_event_percpu kernel/irq/handle.c:246 [inline] handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:263 handle_edge_irq+0x34c/0x950 kernel/irq/chip.c:859 generic_handle_irq_desc include/linux/irqdesc.h:188 [inline] handle_irq arch/x86/kernel/irq.c:209 [inline] call_irq_handler arch/x86/kernel/irq.c:265 [inline] __common_interrupt+0xd8/0x2f0 arch/x86/kernel/irq.c:280 common_interrupt+0xb9/0xe0 arch/x86/kernel/irq.c:273 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:665 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:221 Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 f6 06 12 f6 48 89 df e8 7e 5d 12 f6 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 c5 40 01 f6 65 48 83 3d b4 43 b8 09 00 74 16 5b RSP: 0000:ffffc9000c41edc0 EFLAGS: 00000246 RAX: 0000000000000002 RBX: ffff888024d88a80 RCX: 0000000000000040 RDX: 0000000000000003 RSI: ffffffff8e3e00c5 RDI: ffffffff8c625580 RBP: 0000000000000287 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88802b03c040 R13: ffff88802b03cf20 R14: ffff888024d88a80 R15: ffff888024d88000 class_raw_spinlock_irqsave_destructor include/linux/spinlock.h:594 [inline] try_to_wake_up+0xd8d/0x1c90 kernel/sched/core.c:4315 __mutex_unlock_slowpath+0x32b/0x930 kernel/locking/mutex.c:1077 synchronize_rcu_expedited+0x3c3/0x450 kernel/rcu/tree_exp.h:985 port_delete.isra.0+0x3f/0x210 sound/core/seq/seq_ports.c:261 snd_seq_delete_port+0x228/0x2c0 sound/core/seq/seq_ports.c:296 snd_seq_ioctl_delete_port+0xb6/0x200 sound/core/seq/seq_clientmgr.c:1380 call_seq_client_ctl+0xa3/0x130 sound/core/seq/seq_clientmgr.c:2467 snd_seq_kernel_client_ctl+0x35/0x50 sound/core/seq/seq_clientmgr.c:2495 snd_seq_event_port_detach+0xbb/0x100 sound/core/seq/seq_ports.c:717 snd_seq_midisynth_delete sound/core/seq/seq_midi.c:310 [inline] snd_seq_midisynth_remove+0x266/0x4b0 sound/core/seq/seq_midi.c:482 snd_seq_bus_remove+0x62/0x80 sound/core/seq_device.c:69 device_remove+0xcb/0x180 drivers/base/dd.c:616 __device_release_driver drivers/base/dd.c:1349 [inline] device_release_driver_internal+0x44e/0x620 drivers/base/dd.c:1372 bus_remove_device+0x2bc/0x560 drivers/base/bus.c:664 device_del+0x376/0x9b0 drivers/base/core.c:3965 snd_seq_device_dev_disconnect+0x38/0x50 sound/core/seq_device.c:204 __snd_device_disconnect sound/core/device.c:63 [inline] __snd_device_disconnect sound/core/device.c:59 [inline] snd_device_disconnect_all+0x111/0x1b0 sound/core/device.c:215 snd_card_disconnect.part.0+0x29e/0x5b0 sound/core/init.c:538 snd_card_disconnect+0x1f/0x30 sound/core/init.c:499 __usb_audio_disconnect sound/usb/card.c:1140 [inline] usb_audio_disconnect+0x25a/0x310 sound/usb/card.c:1164 usb_unbind_interface+0x1dd/0x9e0 drivers/usb/core/driver.c:461 device_remove drivers/base/dd.c:618 [inline] device_remove+0x12a/0x180 drivers/base/dd.c:610 __device_release_driver drivers/base/dd.c:1349 [inline] device_release_driver_internal+0x44e/0x620 drivers/base/dd.c:1372 bus_remove_device+0x2bc/0x560 drivers/base/bus.c:664 device_del+0x376/0x9b0 drivers/base/core.c:3965 usb_disable_device+0x367/0x810 drivers/usb/core/message.c:1484 usb_disconnect+0x2e2/0x9a0 drivers/usb/core/hub.c:2355 hub_port_connect drivers/usb/core/hub.c:5425 [inline] hub_port_connect_change drivers/usb/core/hub.c:5725 [inline] port_event drivers/usb/core/hub.c:5889 [inline] hub_event+0x1bb1/0x4420 drivers/usb/core/hub.c:5971 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 6161: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:409 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:426 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5563 _kmalloc_noprof include/linux/slab.h:991 [inline] p9_client_create+0xaf/0xd40 net/9p/client.c:864 v9fs_session_init+0x3c/0xdd0 fs/9p/v9fs.c:471 v9fs_get_tree+0xb8/0xb50 fs/9p/vfs_super.c:97 vfs_get_tree+0x92/0x320 fs/super.c:1932 fc_mount fs/namespace.c:1198 [inline] do_new_mount_fc fs/namespace.c:3772 [inline] do_new_mount fs/namespace.c:3848 [inline] path_mount+0x7d0/0x24c0 fs/namespace.c:4168 do_mount fs/namespace.c:4181 [inline] __do_sys_mount fs/namespace.c:4397 [inline] __se_sys_mount fs/namespace.c:4374 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:4374 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 6161: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:264 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:296 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2748 [inline] slab_free mm/slub.c:6509 [inline] kfree+0x22b/0x6d0 mm/slub.c:6802 p9_client_create+0x72d/0xd40 net/9p/client.c:943 v9fs_session_init+0x3c/0xdd0 fs/9p/v9fs.c:471 v9fs_get_tree+0xb8/0xb50 fs/9p/vfs_super.c:97 vfs_get_tree+0x92/0x320 fs/super.c:1932 fc_mount fs/namespace.c:1198 [inline] do_new_mount_fc fs/namespace.c:3772 [inline] do_new_mount fs/namespace.c:3848 [inline] path_mount+0x7d0/0x24c0 fs/namespace.c:4168 do_mount fs/namespace.c:4181 [inline] __do_sys_mount fs/namespace.c:4397 [inline] __se_sys_mount fs/namespace.c:4374 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:4374 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff8880622f4400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff8880622f4400, ffff8880622f4600) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x622f4 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801d042c80 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff88801d042c80 dead000000000100 dead000000000122 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 04fff00000000002 ffffffffffffff01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5947, tgid 5947 (kworker/u32:6), ts 68211955229 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871 prep_new_page mm/page_alloc.c:1879 [inline] get_page_from_freelist+0x110d/0x35d0 mm/page_alloc.c:3943 __alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436 alloc_slab_page mm/slub.c:3347 [inline] allocate_slab mm/slub.c:3462 [inline] new_slab+0xa9/0x6e0 mm/slub.c:3513 refill_objects+0xe3/0x410 mm/slub.c:7418 refill_sheaf mm/slub.c:2885 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4774 alloc_from_pcs mm/slub.c:4850 [inline] slab_alloc_node mm/slub.c:4984 [inline] __kmalloc_cache_noprof+0x4f4/0x6d0 mm/slub.c:5559 _kmalloc_noprof include/linux/slab.h:991 [inline] batadv_forw_packet_alloc+0x3a9/0x4d0 net/batman-adv/send.c:511 batadv_iv_ogm_aggregate_new+0x11e/0x4c0 net/batman-adv/bat_iv_ogm.c:648 batadv_iv_ogm_queue_add net/batman-adv/bat_iv_ogm.c:769 [inline] batadv_iv_ogm_schedule_buff+0x110a/0x15d0 net/batman-adv/bat_iv_ogm.c:973 batadv_iv_ogm_schedule net/batman-adv/bat_iv_ogm.c:1011 [inline] batadv_iv_ogm_schedule net/batman-adv/bat_iv_ogm.c:1005 [inline] batadv_iv_send_outstanding_bat_ogm_packet+0x517/0x7d0 net/batman-adv/bat_iv_ogm.c:1924 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 page last free pid 6141 tgid 6141 ts 66262098731 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1418 [inline] __free_frozen_pages+0x79f/0x10f0 mm/page_alloc.c:2962 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:361 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4683 [inline] slab_alloc_node mm/slub.c:4996 [inline] kmem_cache_alloc_noprof+0x269/0x6a0 mm/slub.c:5010 new_handle fs/jbd2/transaction.c:457 [inline] jbd2__journal_start+0x194/0x6b0 fs/jbd2/transaction.c:485 __ext4_journal_start_sb+0x314/0x610 fs/ext4/ext4_jbd2.c:122 __ext4_journal_start fs/ext4/ext4_jbd2.h:238 [inline] ext4_dirty_inode+0xa1/0x130 fs/ext4/inode.c:6733 __mark_inode_dirty+0x1f3/0x16e0 fs/fs-writeback.c:2744 generic_update_time fs/inode.c:2252 [inline] file_update_time_flags+0x49c/0x520 fs/inode.c:2482 ext4_page_mkwrite+0x324/0x1860 fs/ext4/inode.c:6902 do_page_mkwrite+0x17a/0x440 mm/memory.c:3816 do_shared_fault mm/memory.c:6076 [inline] do_fault+0x659/0x1830 mm/memory.c:6138 do_pte_missing mm/memory.c:4700 [inline] handle_pte_fault mm/memory.c:6558 [inline] __handle_mm_fault+0x150b/0x2f60 mm/memory.c:6707 handle_mm_fault+0x363/0xa20 mm/memory.c:6876 do_user_addr_fault+0x59c/0x12f0 arch/x86/mm/fault.c:1343 Memory state around the buggy address: ffff8880622f4300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880622f4380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880622f4400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880622f4480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880622f4500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: f5 cmc 1: 53 push %rbx 2: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 7: 48 89 fb mov %rdi,%rbx a: 48 83 c7 18 add $0x18,%rdi e: e8 f6 06 12 f6 call 0xf6120709 13: 48 89 df mov %rbx,%rdi 16: e8 7e 5d 12 f6 call 0xf6125d99 1b: f7 c5 00 02 00 00 test $0x200,%ebp 21: 75 23 jne 0x46 23: 9c pushf 24: 58 pop %rax 25: f6 c4 02 test $0x2,%ah 28: 75 37 jne 0x61 * 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction 2f: e8 c5 40 01 f6 call 0xf60140f9 34: 65 48 83 3d b4 43 b8 cmpq $0x0,%gs:0x9b843b4(%rip) # 0x9b843f1 3b: 09 00 3d: 74 16 je 0x55 3f: 5b pop %rbx