================================================================== BUG: KASAN: slab-use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:183 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock_common kernel/locking/mutex.c:678 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock+0xe87/0x1060 kernel/locking/mutex.c:760 Read of size 8 at addr ffff8880415700a0 by task khidpd_10cf0005/16933 CPU: 3 UID: 0 PID: 16933 Comm: khidpd_10cf0005 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 __mutex_waiter_is_first kernel/locking/mutex.c:183 [inline] __mutex_lock_common kernel/locking/mutex.c:678 [inline] __mutex_lock+0xe87/0x1060 kernel/locking/mutex.c:760 l2cap_unregister_user+0x71/0x240 net/bluetooth/l2cap_core.c:1728 hidp_session_thread+0x45e/0x660 net/bluetooth/hidp/core.c:1304 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x675/0x7d0 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 16795: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 poison_kmalloc_redzone mm/kasan/common.c:400 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:417 kasan_kmalloc include/linux/kasan.h:262 [inline] __do_kmalloc_node mm/slub.c:5650 [inline] __kmalloc_noprof+0x32f/0x880 mm/slub.c:5662 kmalloc_noprof include/linux/slab.h:961 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] hci_alloc_dev_priv+0x1d/0x28a0 net/bluetooth/hci_core.c:2448 hci_alloc_dev include/net/bluetooth/hci_core.h:1751 [inline] __vhci_create_device+0xf0/0x880 drivers/bluetooth/hci_vhci.c:421 vhci_create_device drivers/bluetooth/hci_vhci.c:479 [inline] vhci_get_user drivers/bluetooth/hci_vhci.c:536 [inline] vhci_write+0x2c0/0x480 drivers/bluetooth/hci_vhci.c:616 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x7d3/0x11d0 fs/read_write.c:686 ksys_write+0x12a/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 16795: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 __kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:587 kasan_save_free_info mm/kasan/kasan.h:406 [inline] poison_slab_object mm/kasan/common.c:252 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:234 [inline] slab_free_hook mm/slub.c:2543 [inline] slab_free mm/slub.c:6638 [inline] kfree+0x2b8/0x6d0 mm/slub.c:6845 hci_release_dev+0x4ef/0x610 net/bluetooth/hci_core.c:2776 bt_host_release+0x6a/0xb0 net/bluetooth/hci_sysfs.c:87 device_release+0xa4/0x240 drivers/base/core.c:2565 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1e7/0x5a0 lib/kobject.c:737 put_device+0x1f/0x30 drivers/base/core.c:3797 vhci_release+0x185/0x230 drivers/bluetooth/hci_vhci.c:691 __fput+0x402/0xb70 fs/file_table.c:468 task_work_run+0x150/0x240 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x86f/0x2bf0 kernel/exit.c:966 do_group_exit+0xd3/0x2a0 kernel/exit.c:1107 __do_sys_exit_group kernel/exit.c:1118 [inline] __se_sys_exit_group kernel/exit.c:1116 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1116 x64_sys_call+0x150b/0x1730 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Last potentially related work creation: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:559 insert_work+0x36/0x230 kernel/workqueue.c:2186 __queue_work+0x3f8/0x1160 kernel/workqueue.c:2345 queue_work_on+0x1a4/0x1f0 kernel/workqueue.c:2392 queue_work include/linux/workqueue.h:669 [inline] hci_cmd_complete_evt+0x72a/0xa20 net/bluetooth/hci_event.c:4250 hci_event_func net/bluetooth/hci_event.c:7570 [inline] hci_event_packet+0x685/0x11c0 net/bluetooth/hci_event.c:7627 hci_rx_work+0x2c5/0x16b0 net/bluetooth/hci_core.c:4099 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x675/0x7d0 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Second to last potentially related work creation: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:559 insert_work+0x36/0x230 kernel/workqueue.c:2186 __queue_work+0x97e/0x1160 kernel/workqueue.c:2341 queue_work_on+0x1a4/0x1f0 kernel/workqueue.c:2392 queue_work include/linux/workqueue.h:669 [inline] hci_recv_frame+0x503/0x880 net/bluetooth/hci_core.c:2968 vhci_get_user drivers/bluetooth/hci_vhci.c:520 [inline] vhci_write+0x399/0x480 drivers/bluetooth/hci_vhci.c:616 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x7d3/0x11d0 fs/read_write.c:686 ksys_write+0x12a/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888041570000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 160 bytes inside of freed 8192-byte region [ffff888041570000, ffff888041572000) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x41570 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b443180 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000020002 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b443180 dead000000000122 0000000000000000 head: 0000000000000000 0000000000020002 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea0001055c01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 16795, tgid 16795 (syz-executor), ts 273359575306, free_ts 273258686506 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1850 prep_new_page mm/page_alloc.c:1858 [inline] get_page_from_freelist+0x10a3/0x3a30 mm/page_alloc.c:3884 __alloc_frozen_pages_noprof+0x25f/0x2470 mm/page_alloc.c:5183 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416 alloc_slab_page mm/slub.c:3059 [inline] allocate_slab mm/slub.c:3232 [inline] new_slab+0x24a/0x360 mm/slub.c:3286 ___slab_alloc+0xd79/0x1a50 mm/slub.c:4655 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4778 __slab_alloc_node mm/slub.c:4854 [inline] slab_alloc_node mm/slub.c:5276 [inline] __do_kmalloc_node mm/slub.c:5649 [inline] __kmalloc_noprof+0x501/0x880 mm/slub.c:5662 kmalloc_noprof include/linux/slab.h:961 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] hci_alloc_dev_priv+0x1d/0x28a0 net/bluetooth/hci_core.c:2448 hci_alloc_dev include/net/bluetooth/hci_core.h:1751 [inline] __vhci_create_device+0xf0/0x880 drivers/bluetooth/hci_vhci.c:421 vhci_create_device drivers/bluetooth/hci_vhci.c:479 [inline] vhci_get_user drivers/bluetooth/hci_vhci.c:536 [inline] vhci_write+0x2c0/0x480 drivers/bluetooth/hci_vhci.c:616 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x7d3/0x11d0 fs/read_write.c:686 ksys_write+0x12a/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 16794 tgid 16794 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] __free_frozen_pages+0x7df/0x1160 mm/page_alloc.c:2906 discard_slab mm/slub.c:3330 [inline] __put_partials+0x130/0x170 mm/slub.c:3876 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4d/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:352 kasan_slab_alloc include/linux/kasan.h:252 [inline] slab_post_alloc_hook mm/slub.c:4978 [inline] slab_alloc_node mm/slub.c:5288 [inline] kmem_cache_alloc_noprof+0x250/0x6e0 mm/slub.c:5295 vm_area_alloc+0x1f/0x160 mm/vma_init.c:32 __mmap_new_vma mm/vma.c:2461 [inline] __mmap_region+0xf85/0x27a0 mm/vma.c:2670 mmap_region+0x1ab/0x3f0 mm/vma.c:2740 do_mmap+0xa3e/0x1210 mm/mmap.c:558 vm_mmap_pgoff+0x29e/0x470 mm/util.c:581 ksys_mmap_pgoff+0x7d/0x5c0 mm/mmap.c:604 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:89 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:82 [inline] __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:82 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88804156ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888041570000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888041570080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888041570100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888041570180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================