================================================================== BUG: KASAN: slab-use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:199 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock_common kernel/locking/mutex.c:694 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock+0x1a24/0x1ca0 kernel/locking/mutex.c:776 Read of size 8 at addr ffff88803959bb20 by task kworker/2:6/14937 CPU: 2 UID: 0 PID: 14937 Comm: kworker/2:6 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 Workqueue: events l2cap_chan_timeout 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:199 [inline] __mutex_lock_common kernel/locking/mutex.c:694 [inline] __mutex_lock+0x1a24/0x1ca0 kernel/locking/mutex.c:776 l2cap_chan_timeout+0x6d/0x340 net/bluetooth/l2cap_core.c:417 process_one_work+0x9ba/0x1b20 kernel/workqueue.c:3257 process_scheduled_works kernel/workqueue.c:3340 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3421 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x983/0xb10 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 Allocated by task 13439: 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:397 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:414 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] l2cap_conn_add.part.0+0x60/0xa90 net/bluetooth/l2cap_core.c:6887 l2cap_conn_add include/net/bluetooth/hci_core.h:1686 [inline] l2cap_chan_connect+0x1691/0x2150 net/bluetooth/l2cap_core.c:7078 l2cap_sock_connect+0x3ba/0x770 net/bluetooth/l2cap_sock.c:256 kernel_connect+0x107/0x180 net/socket.c:3634 rfcomm_session_create net/bluetooth/rfcomm/core.c:811 [inline] __rfcomm_dlc_open net/bluetooth/rfcomm/core.c:388 [inline] rfcomm_dlc_open+0x84a/0xaf0 net/bluetooth/rfcomm/core.c:431 rfcomm_sock_connect+0x423/0x6a0 net/bluetooth/rfcomm/sock.c:410 __sys_connect_file+0x141/0x1a0 net/socket.c:2089 __sys_connect+0x13b/0x160 net/socket.c:2108 __do_sys_connect net/socket.c:2114 [inline] __se_sys_connect net/socket.c:2111 [inline] __x64_sys_connect+0x72/0xb0 net/socket.c:2111 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 10535: 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:584 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:2540 [inline] slab_free mm/slub.c:6668 [inline] kfree+0x2f8/0x6e0 mm/slub.c:6876 l2cap_conn_free net/bluetooth/l2cap_core.c:1812 [inline] kref_put include/linux/kref.h:65 [inline] l2cap_conn_put net/bluetooth/l2cap_core.c:1824 [inline] l2cap_conn_del+0x5c7/0x760 net/bluetooth/l2cap_core.c:1804 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7326 [inline] l2cap_disconn_cfm+0x95/0xf0 net/bluetooth/l2cap_core.c:7319 hci_disconn_cfm include/net/bluetooth/hci_core.h:2146 [inline] hci_conn_hash_flush+0x10e/0x290 net/bluetooth/hci_conn.c:2637 hci_dev_close_sync+0x601/0x1260 net/bluetooth/hci_sync.c:5326 hci_dev_do_close+0x2e/0xc0 net/bluetooth/hci_core.c:501 hci_unregister_dev+0x227/0x680 net/bluetooth/hci_core.c:2715 vhci_release+0x17d/0x230 drivers/bluetooth/hci_vhci.c:690 __fput+0x402/0xb70 fs/file_table.c:468 task_work_run+0x150/0x240 kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x87f/0x2bd0 kernel/exit.c:971 do_group_exit+0xd3/0x2a0 kernel/exit.c:1112 get_signal+0x2671/0x26d0 kernel/signal.c:3034 arch_do_signal_or_restart+0x8f/0x7e0 arch/x86/kernel/signal.c:337 __exit_to_user_mode_loop kernel/entry/common.c:41 [inline] exit_to_user_mode_loop+0x8c/0x540 kernel/entry/common.c:75 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline] do_syscall_64+0x4ee/0xf80 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88803959b800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 800 bytes inside of freed 1024-byte region [ffff88803959b800, ffff88803959bc00) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88803959c000 pfn:0x39598 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000240 ffff88801b442dc0 ffffea0001584010 ffffea0000857410 raw: ffff88803959c000 000000000010000d 00000000f5000000 0000000000000000 head: 00fff00000000240 ffff88801b442dc0 ffffea0001584010 ffffea0000857410 head: ffff88803959c000 000000000010000d 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea0000e56601 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 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 0, tgid 0 (swapper/0), ts 63847706188, free_ts 63417220932 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1af/0x220 mm/page_alloc.c:1846 prep_new_page mm/page_alloc.c:1854 [inline] get_page_from_freelist+0xd0b/0x31a0 mm/page_alloc.c:3915 __alloc_frozen_pages_noprof+0x25f/0x2430 mm/page_alloc.c:5210 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2486 alloc_slab_page mm/slub.c:3075 [inline] allocate_slab mm/slub.c:3248 [inline] new_slab+0x2c3/0x430 mm/slub.c:3302 ___slab_alloc+0xe18/0x1c90 mm/slub.c:4656 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4779 __slab_alloc_node mm/slub.c:4855 [inline] slab_alloc_node mm/slub.c:5251 [inline] __do_kmalloc_node mm/slub.c:5656 [inline] __kmalloc_noprof+0x4fc/0x910 mm/slub.c:5669 kmalloc_noprof include/linux/slab.h:961 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] ieee802_11_parse_elems_full+0x1db/0x3780 net/mac80211/parse.c:1031 ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2469 [inline] ieee80211_inform_bss+0x15a/0x1150 net/mac80211/scan.c:79 rdev_inform_bss net/wireless/rdev-ops.h:418 [inline] cfg80211_inform_single_bss_data+0x8e9/0x1d30 net/wireless/scan.c:2373 cfg80211_inform_bss_data+0x22b/0x3be0 net/wireless/scan.c:3228 cfg80211_inform_bss_frame_data+0x26f/0x720 net/wireless/scan.c:3319 ieee80211_bss_info_update+0x310/0xab0 net/mac80211/scan.c:230 ieee80211_scan_rx+0x4cf/0xb30 net/mac80211/scan.c:359 __ieee80211_rx_handle_packet net/mac80211/rx.c:5282 [inline] ieee80211_rx_list+0x1c40/0x2ed0 net/mac80211/rx.c:5539 page last free pid 6525 tgid 6525 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] __free_frozen_pages+0x7df/0x1170 mm/page_alloc.c:2943 discard_slab mm/slub.c:3346 [inline] __put_partials+0x130/0x170 mm/slub.c:3886 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4c/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:349 kasan_slab_alloc include/linux/kasan.h:252 [inline] slab_post_alloc_hook mm/slub.c:4953 [inline] slab_alloc_node mm/slub.c:5263 [inline] kmem_cache_alloc_noprof+0x25e/0x770 mm/slub.c:5270 getname_flags.part.0+0x4c/0x550 fs/namei.c:146 getname_flags+0x93/0xf0 include/linux/audit.h:345 getname include/linux/fs.h:2498 [inline] do_sys_openat2+0xb9/0x290 fs/open.c:1426 do_sys_open fs/open.c:1436 [inline] __do_sys_openat fs/open.c:1452 [inline] __se_sys_openat fs/open.c:1447 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1447 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88803959ba00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803959ba80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88803959bb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803959bb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803959bc00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================