====================================================== WARNING: possible circular locking dependency detected 5.15.186-syzkaller #0 Not tainted ------------------------------------------------------ kworker/u5:6/4998 is trying to acquire lock: ffff88807bb22120 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1694 [inline] ffff88807bb22120 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_conn_ready net/bluetooth/sco.c:1113 [inline] ffff88807bb22120 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_connect_cfm+0x148/0xa40 net/bluetooth/sco.c:1204 but task is already holding lock: ffffffff8d370c48 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1502 [inline] ffffffff8d370c48 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0x471/0x9f0 net/bluetooth/hci_event.c:4551 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+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 hci_connect_cfm include/net/bluetooth/hci_core.h:1502 [inline] hci_remote_features_evt+0x5cf/0xa10 net/bluetooth/hci_event.c:3352 hci_event_packet+0x613/0x12f0 net/bluetooth/hci_event.c:6419 hci_rx_work+0x255/0xa10 net/bluetooth/hci_core.c:5160 process_one_work+0x863/0x1000 kernel/workqueue.c:2310 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457 kthread+0x436/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #1 (&hdev->lock){+.+.}-{3:3}: __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 sco_sock_connect+0x18f/0x910 net/bluetooth/sco.c:597 __sys_connect_file net/socket.c:1923 [inline] __sys_connect+0x389/0x410 net/socket.c:1940 __do_sys_connect net/socket.c:1950 [inline] __se_sys_connect net/socket.c:1947 [inline] __x64_sys_connect+0x76/0x80 net/socket.c:1947 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #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+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 lock_sock_nested+0x44/0x100 net/core/sock.c:3251 lock_sock include/net/sock.h:1694 [inline] sco_conn_ready net/bluetooth/sco.c:1113 [inline] sco_connect_cfm+0x148/0xa40 net/bluetooth/sco.c:1204 hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline] hci_sync_conn_complete_evt+0x4d1/0x9f0 net/bluetooth/hci_event.c:4551 hci_event_packet+0x8da/0x12f0 net/bluetooth/hci_event.c:6481 hci_rx_work+0x255/0xa10 net/bluetooth/hci_core.c:5160 process_one_work+0x863/0x1000 kernel/workqueue.c:2310 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457 kthread+0x436/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 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:6/4998: #0: ffff8880245ea938 ((wq_completion)hci4#2){+.+.}-{0:0}, at: process_one_work+0x760/0x1000 kernel/workqueue.c:-1 #1: ffffc9000338fd00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x7a3/0x1000 kernel/workqueue.c:2285 #2: ffff8880743a0078 (&hdev->lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0xb4/0x9f0 net/bluetooth/hci_event.c:4471 #3: ffffffff8d370c48 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1502 [inline] #3: ffffffff8d370c48 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0x471/0x9f0 net/bluetooth/hci_event.c:4551 stack backtrace: CPU: 1 PID: 4998 Comm: kworker/u5:6 Not tainted 5.15.186-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Workqueue: hci4 hci_rx_work Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 check_noncircular+0x274/0x310 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+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 lock_sock_nested+0x44/0x100 net/core/sock.c:3251 lock_sock include/net/sock.h:1694 [inline] sco_conn_ready net/bluetooth/sco.c:1113 [inline] sco_connect_cfm+0x148/0xa40 net/bluetooth/sco.c:1204 hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline] hci_sync_conn_complete_evt+0x4d1/0x9f0 net/bluetooth/hci_event.c:4551 hci_event_packet+0x8da/0x12f0 net/bluetooth/hci_event.c:6481 hci_rx_work+0x255/0xa10 net/bluetooth/hci_core.c:5160 process_one_work+0x863/0x1000 kernel/workqueue.c:2310 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457 kthread+0x436/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 ================================================================== 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+0x235/0x280 kernel/locking/spinlock_debug.c:114 Read of size 4 at addr ffff88807bb2208c by task kworker/u5:6/4998 CPU: 1 PID: 4998 Comm: kworker/u5:6 Not tainted 5.15.186-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Workqueue: hci4 hci_rx_work Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 print_address_description+0x60/0x2d0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0xdf/0x130 mm/kasan/report.c:451 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] do_raw_spin_lock+0x235/0x280 kernel/locking/spinlock_debug.c:114 spin_lock_bh include/linux/spinlock.h:368 [inline] lock_sock_nested+0x68/0x100 net/core/sock.c:3254 lock_sock include/net/sock.h:1694 [inline] sco_conn_ready net/bluetooth/sco.c:1113 [inline] sco_connect_cfm+0x148/0xa40 net/bluetooth/sco.c:1204 hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline] hci_sync_conn_complete_evt+0x4d1/0x9f0 net/bluetooth/hci_event.c:4551 hci_event_packet+0x8da/0x12f0 net/bluetooth/hci_event.c:6481 hci_rx_work+0x255/0xa10 net/bluetooth/hci_core.c:5160 process_one_work+0x863/0x1000 kernel/workqueue.c:2310 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457 kthread+0x436/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Allocated by task 5363: 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 mm/kasan/common.c:513 [inline] __kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522 kmalloc include/linux/slab.h:609 [inline] sk_prot_alloc+0xe7/0x210 net/core/sock.c:1864 sk_alloc+0x2f/0x310 net/core/sock.c:1917 sco_sock_alloc net/bluetooth/sco.c:491 [inline] sco_sock_create+0xba/0x300 net/bluetooth/sco.c:526 bt_sock_create+0x155/0x220 net/bluetooth/af_bluetooth.c:130 __sock_create+0x47b/0x900 net/socket.c:1486 sock_create net/socket.c:1542 [inline] __sys_socket+0xe2/0x170 net/socket.c:1584 __do_sys_socket net/socket.c:1593 [inline] __se_sys_socket net/socket.c:1591 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1591 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Freed by task 5363: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0xea/0x170 mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kfree+0xef/0x2a0 mm/slub.c:4559 sk_prot_free net/core/sock.c:1900 [inline] __sk_destruct+0x55a/0x820 net/core/sock.c:1986 sco_sock_release+0x254/0x310 net/bluetooth/sco.c:1101 __sock_release net/socket.c:649 [inline] sock_close+0xd5/0x240 net/socket.c:1336 __fput+0x234/0x930 fs/file_table.c:311 task_work_run+0x125/0x1a0 kernel/task_work.c:188 get_signal+0x1222/0x12c0 kernel/signal.c:2672 arch_do_signal_or_restart+0xc1/0x1300 arch/x86/kernel/signal.c:867 handle_signal_work kernel/entry/common.c:154 [inline] exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 The buggy address belongs to the object at ffff88807bb22000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 140 bytes inside of 2048-byte region [ffff88807bb22000, ffff88807bb22800) The buggy address belongs to the page: page:ffffea0001eec800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7bb20 head:ffffea0001eec800 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 0000000400000001 ffff888016842000 raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4987, ts 82513124196, free_ts 82493019868 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5474 alloc_slab_page mm/slub.c:1775 [inline] allocate_slab mm/slub.c:1912 [inline] new_slab+0xc0/0x4b0 mm/slub.c:1975 ___slab_alloc+0x81e/0xdf0 mm/slub.c:3008 __slab_alloc mm/slub.c:3095 [inline] slab_alloc_node mm/slub.c:3186 [inline] __kmalloc_node_track_caller+0x1fc/0x3a0 mm/slub.c:4958 kmalloc_reserve net/core/skbuff.c:356 [inline] pskb_expand_head+0x127/0x10f0 net/core/skbuff.c:1709 netlink_trim+0x180/0x220 net/netlink/af_netlink.c:1293 netlink_broadcast_filtered+0x7c/0x1170 net/netlink/af_netlink.c:1498 netlink_broadcast net/netlink/af_netlink.c:1543 [inline] nlmsg_multicast include/net/netlink.h:1033 [inline] nlmsg_notify+0xec/0x1a0 net/netlink/af_netlink.c:2532 rtnl_notify net/core/rtnetlink.c:759 [inline] rtmsg_ifinfo_send net/core/rtnetlink.c:3908 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:3923 [inline] rtnetlink_event+0x13a/0x1a0 net/core/rtnetlink.c:5701 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:391 __netdev_upper_dev_link+0x3c0/0x580 net/core/dev.c:8199 netdev_master_upper_dev_link+0xad/0xf0 net/core/dev.c:8269 batadv_hardif_enable_interface+0x1d3/0x990 net/batman-adv/hard-interface.c:722 batadv_softif_slave_add+0x72/0xf0 net/batman-adv/soft-interface.c:842 do_set_master net/core/rtnetlink.c:2575 [inline] do_setlink+0xd84/0x3980 net/core/rtnetlink.c:2786 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] free_pcp_prepare mm/page_alloc.c:1391 [inline] free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317 free_unref_page+0x94/0x280 mm/page_alloc.c:3396 free_slab mm/slub.c:2015 [inline] discard_slab mm/slub.c:2021 [inline] __unfreeze_partials+0x1a5/0x200 mm/slub.c:2507 put_cpu_partial+0x12d/0x190 mm/slub.c:2587 qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519 slab_alloc_node mm/slub.c:3220 [inline] slab_alloc mm/slub.c:3228 [inline] __kmalloc+0x127/0x330 mm/slub.c:4403 kmalloc include/linux/slab.h:609 [inline] tomoyo_realpath_from_path+0x118/0x610 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x1cd/0x510 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x120 security/security.c:1348 vfs_getattr+0x26/0x3a0 fs/stat.c:157 vfs_fstat fs/stat.c:182 [inline] __do_sys_newfstat fs/stat.c:421 [inline] __se_sys_newfstat fs/stat.c:418 [inline] __x64_sys_newfstat+0x104/0x1d0 fs/stat.c:418 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Memory state around the buggy address: ffff88807bb21f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807bb22000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807bb22080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807bb22100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807bb22180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================