====================================================== WARNING: possible circular locking dependency detected 5.15.158-syzkaller #0 Not tainted ------------------------------------------------------ kworker/u5:0/144 is trying to acquire lock: ffff0000ee262120 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1668 [inline] ffff0000ee262120 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_conn_ready net/bluetooth/sco.c:1106 [inline] ffff0000ee262120 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_connect_cfm+0x140/0x908 net/bluetooth/sco.c:1197 but task is already holding lock: ffff800016b7a068 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1507 [inline] ffff800016b7a068 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_conn_complete_evt+0xa74/0x11f8 net/bluetooth/hci_event.c:2796 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (hci_cb_list_lock){+.+.}-{3:3}: __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 hci_connect_cfm include/net/bluetooth/hci_core.h:1507 [inline] hci_remote_features_evt+0x480/0x940 net/bluetooth/hci_event.c:3352 hci_event_packet+0x5ec/0x12b4 net/bluetooth/hci_event.c:6421 hci_rx_work+0x1c0/0x7c4 net/bluetooth/hci_core.c:5156 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310 worker_thread+0x910/0x1034 kernel/workqueue.c:2457 kthread+0x37c/0x45c kernel/kthread.c:334 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 -> #1 (&hdev->lock){+.+.}-{3:3}: __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 sco_sock_connect+0x170/0x848 net/bluetooth/sco.c:587 __sys_connect_file net/socket.c:1918 [inline] __sys_connect+0x268/0x290 net/socket.c:1935 __do_sys_connect net/socket.c:1945 [inline] __se_sys_connect net/socket.c:1942 [inline] __arm64_sys_connect+0x7c/0x94 net/socket.c:1942 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #0 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623 lock_sock_nested+0xec/0x1ec net/core/sock.c:3250 lock_sock include/net/sock.h:1668 [inline] sco_conn_ready net/bluetooth/sco.c:1106 [inline] sco_connect_cfm+0x140/0x908 net/bluetooth/sco.c:1197 hci_connect_cfm include/net/bluetooth/hci_core.h:1510 [inline] hci_conn_complete_evt+0xad8/0x11f8 net/bluetooth/hci_event.c:2796 hci_event_packet+0x8c0/0x12b4 net/bluetooth/hci_event.c:6393 hci_rx_work+0x1c0/0x7c4 net/bluetooth/hci_core.c:5156 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310 worker_thread+0x910/0x1034 kernel/workqueue.c:2457 kthread+0x37c/0x45c kernel/kthread.c:334 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 other info that might help us debug this: Chain exists of: sk_lock-AF_BLUETOOTH-BTPROTO_SCO --> &hdev->lock --> hci_cb_list_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(hci_cb_list_lock); lock(&hdev->lock); lock(hci_cb_list_lock); lock(sk_lock-AF_BLUETOOTH-BTPROTO_SCO); *** DEADLOCK *** 4 locks held by kworker/u5:0/144: #0: ffff0000dab05138 ((wq_completion)hci4#2){+.+.}-{0:0}, at: process_one_work+0x66c/0x11b8 kernel/workqueue.c:2283 #1: ffff80001a417c00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x6ac/0x11b8 kernel/workqueue.c:2285 #2: ffff0000d79f0078 (&hdev->lock){+.+.}-{3:3}, at: hci_conn_complete_evt+0xc0/0x11f8 net/bluetooth/hci_event.c:2672 #3: ffff800016b7a068 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1507 [inline] #3: ffff800016b7a068 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_conn_complete_evt+0xa74/0x11f8 net/bluetooth/hci_event.c:2796 stack backtrace: CPU: 1 PID: 144 Comm: kworker/u5:0 Not tainted 5.15.158-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: hci4 hci_rx_work Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x58 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623 lock_sock_nested+0xec/0x1ec net/core/sock.c:3250 lock_sock include/net/sock.h:1668 [inline] sco_conn_ready net/bluetooth/sco.c:1106 [inline] sco_connect_cfm+0x140/0x908 net/bluetooth/sco.c:1197 hci_connect_cfm include/net/bluetooth/hci_core.h:1510 [inline] hci_conn_complete_evt+0xad8/0x11f8 net/bluetooth/hci_event.c:2796 hci_event_packet+0x8c0/0x12b4 net/bluetooth/hci_event.c:6393 hci_rx_work+0x1c0/0x7c4 net/bluetooth/hci_core.c:5156 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310 worker_thread+0x910/0x1034 kernel/workqueue.c:2457 kthread+0x37c/0x45c kernel/kthread.c:334 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 ================================================================== BUG: KASAN: use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] BUG: KASAN: use-after-free in do_raw_spin_lock+0x244/0x35c kernel/locking/spinlock_debug.c:114 Read of size 4 at addr ffff0000ee26208c by task kworker/u5:0/144 CPU: 1 PID: 144 Comm: kworker/u5:0 Not tainted 5.15.158-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: hci4 hci_rx_work Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x174/0x1e4 mm/kasan/report.c:451 __asan_report_load4_noabort+0x44/0x50 mm/kasan/report_generic.c:308 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] do_raw_spin_lock+0x244/0x35c kernel/locking/spinlock_debug.c:114 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:136 [inline] _raw_spin_lock_bh+0x12c/0x1c4 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:368 [inline] lock_sock_nested+0x108/0x1ec net/core/sock.c:3253 lock_sock include/net/sock.h:1668 [inline] sco_conn_ready net/bluetooth/sco.c:1106 [inline] sco_connect_cfm+0x140/0x908 net/bluetooth/sco.c:1197 hci_connect_cfm include/net/bluetooth/hci_core.h:1510 [inline] hci_conn_complete_evt+0xad8/0x11f8 net/bluetooth/hci_event.c:2796 hci_event_packet+0x8c0/0x12b4 net/bluetooth/hci_event.c:6393 hci_rx_work+0x1c0/0x7c4 net/bluetooth/hci_core.c:5156 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310 worker_thread+0x910/0x1034 kernel/workqueue.c:2457 kthread+0x37c/0x45c kernel/kthread.c:334 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 Allocated by task 5520: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:264 [inline] __kmalloc+0x29c/0x4c8 mm/slub.c:4407 kmalloc include/linux/slab.h:596 [inline] sk_prot_alloc+0xc4/0x1f0 net/core/sock.c:1863 sk_alloc+0x40/0x3e0 net/core/sock.c:1916 sco_sock_alloc net/bluetooth/sco.c:481 [inline] sco_sock_create+0xb8/0x2d4 net/bluetooth/sco.c:516 bt_sock_create+0x14c/0x248 net/bluetooth/af_bluetooth.c:130 __sock_create+0x43c/0x884 net/socket.c:1486 sock_create net/socket.c:1537 [inline] __sys_socket+0x168/0x310 net/socket.c:1579 __do_sys_socket net/socket.c:1588 [inline] __se_sys_socket net/socket.c:1586 [inline] __arm64_sys_socket+0x7c/0x94 net/socket.c:1586 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Freed by task 5520: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x84 mm/kasan/common.c:46 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kfree+0x178/0x410 mm/slub.c:4559 sk_prot_free net/core/sock.c:1899 [inline] __sk_destruct+0x418/0x600 net/core/sock.c:1985 sk_destruct net/core/sock.c:2000 [inline] __sk_free+0x37c/0x4e8 net/core/sock.c:2011 sk_free+0x68/0xdc net/core/sock.c:2022 sock_put include/net/sock.h:1913 [inline] sco_sock_kill+0x104/0x1c8 net/bluetooth/sco.c:402 sco_sock_release+0x1fc/0x2c0 net/bluetooth/sco.c:1094 __sock_release net/socket.c:649 [inline] sock_close+0xb8/0x1fc net/socket.c:1336 __fput+0x30c/0x7f0 fs/file_table.c:280 ____fput+0x20/0x30 fs/file_table.c:308 task_work_run+0x130/0x1e4 kernel/task_work.c:164 get_signal+0x1450/0x1550 kernel/signal.c:2661 do_signal arch/arm64/kernel/signal.c:890 [inline] do_notify_resume+0x3d0/0x32b8 arch/arm64/kernel/signal.c:943 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline] el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:609 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Last potentially related work creation: kasan_save_stack+0x38/0x68 mm/kasan/common.c:38 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3007 [inline] call_rcu+0x118/0xb40 kernel/rcu/tree.c:3087 in6_dev_finish_destroy+0x154/0x1e0 net/ipv6/addrconf_core.c:278 in6_dev_put include/net/addrconf.h:386 [inline] addrconf_ifdown+0x1568/0x1814 net/ipv6/addrconf.c:3933 addrconf_notify+0x350/0xc58 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xd4/0x164 kernel/notifier.c:391 call_netdevice_notifiers_info net/core/dev.c:2018 [inline] call_netdevice_notifiers_extack net/core/dev.c:2030 [inline] call_netdevice_notifiers net/core/dev.c:2044 [inline] unregister_netdevice_many+0xec4/0x189c net/core/dev.c:11093 rtnl_delete_link net/core/rtnetlink.c:3085 [inline] rtnl_dellink+0x428/0x6cc net/core/rtnetlink.c:3137 rtnetlink_rcv_msg+0xa74/0xdac net/core/rtnetlink.c:5629 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2505 rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:5647 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1356 netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1924 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x584/0x870 net/socket.c:2431 ___sys_sendmsg+0x214/0x294 net/socket.c:2485 __sys_sendmsg net/socket.c:2514 [inline] __do_sys_sendmsg net/socket.c:2523 [inline] __se_sys_sendmsg net/socket.c:2521 [inline] __arm64_sys_sendmsg+0x1ac/0x25c net/socket.c:2521 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Second to last potentially related work creation: kasan_save_stack+0x38/0x68 mm/kasan/common.c:38 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348 insert_work+0x64/0x394 kernel/workqueue.c:1366 __queue_work+0xb84/0x114c kernel/workqueue.c:1532 delayed_work_timer_fn+0x74/0x90 kernel/workqueue.c:1657 call_timer_fn+0x19c/0x8f0 kernel/time/timer.c:1451 expire_timers kernel/time/timer.c:1491 [inline] __run_timers+0x584/0x718 kernel/time/timer.c:1767 run_timer_softirq+0x7c/0x114 kernel/time/timer.c:1780 __do_softirq+0x344/0xdb0 kernel/softirq.c:558 The buggy address belongs to the object at ffff0000ee262000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 140 bytes inside of 2048-byte region [ffff0000ee262000, ffff0000ee262800) The buggy address belongs to the page: page:000000008eaf6d32 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12e260 head:000000008eaf6d32 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff) raw: 05ffc00000010200 0000000000000000 0000000100000001 ffff0000c0002900 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000ee261f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000ee262000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000ee262080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000ee262100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000ee262180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================