======================================================
WARNING: possible circular locking dependency detected
5.15.168-syzkaller #0 Not tainted
------------------------------------------------------
kworker/u5:5/3583 is trying to acquire lock:
ffff88807b183120 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1678 [inline]
ffff88807b183120 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_conn_ready net/bluetooth/sco.c:1110 [inline]
ffff88807b183120 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_connect_cfm+0x146/0xad0 net/bluetooth/sco.c:1201
but task is already holding lock:
ffffffff8db7b528 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1502 [inline]
ffffffff8db7b528 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0x45f/0x9b0 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}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1da/0x25a0 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+0x52f/0xb50 net/bluetooth/hci_event.c:3352
hci_event_packet+0x6fe/0x1550 net/bluetooth/hci_event.c:6421
hci_rx_work+0x232/0x990 net/bluetooth/hci_core.c:5155
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
-> #1 (&hdev->lock){+.+.}-{3:3}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1da/0x25a0 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+0x181/0x8e0 net/bluetooth/sco.c:591
__sys_connect_file net/socket.c:1923 [inline]
__sys_connect+0x38b/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+0x3b/0xb0 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+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
lock_sock_nested+0x44/0x100 net/core/sock.c:3250
lock_sock include/net/sock.h:1678 [inline]
sco_conn_ready net/bluetooth/sco.c:1110 [inline]
sco_connect_cfm+0x146/0xad0 net/bluetooth/sco.c:1201
hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline]
hci_sync_conn_complete_evt+0x4ce/0x9b0 net/bluetooth/hci_event.c:4551
hci_event_packet+0xa12/0x1550 net/bluetooth/hci_event.c:6483
hci_rx_work+0x232/0x990 net/bluetooth/hci_core.c:5155
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 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:5/3583:
#0: ffff888023e48138 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work+0x78a/0x10c0 kernel/workqueue.c:2283
#1: ffffc90002eb7d20 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x7d0/0x10c0 kernel/workqueue.c:2285
#2: ffff888075e38078 (&hdev->lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0xab/0x9b0 net/bluetooth/hci_event.c:4471
#3: ffffffff8db7b528 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1502 [inline]
#3: ffffffff8db7b528 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0x45f/0x9b0 net/bluetooth/hci_event.c:4551
stack backtrace:
CPU: 1 PID: 3583 Comm: kworker/u5:5 Not tainted 5.15.168-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: hci0 hci_rx_work
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
check_noncircular+0x2f8/0x3b0 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+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
lock_sock_nested+0x44/0x100 net/core/sock.c:3250
lock_sock include/net/sock.h:1678 [inline]
sco_conn_ready net/bluetooth/sco.c:1110 [inline]
sco_connect_cfm+0x146/0xad0 net/bluetooth/sco.c:1201
hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline]
hci_sync_conn_complete_evt+0x4ce/0x9b0 net/bluetooth/hci_event.c:4551
hci_event_packet+0xa12/0x1550 net/bluetooth/hci_event.c:6483
hci_rx_work+0x232/0x990 net/bluetooth/hci_core.c:5155
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 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+0x290/0x370 kernel/locking/spinlock_debug.c:114
Read of size 4 at addr ffff88807b18308c by task kworker/u5:5/3583
CPU: 1 PID: 3583 Comm: kworker/u5:5 Not tainted 5.15.168-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: hci0 hci_rx_work
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline]
do_raw_spin_lock+0x290/0x370 kernel/locking/spinlock_debug.c:114
spin_lock_bh include/linux/spinlock.h:368 [inline]
lock_sock_nested+0x68/0x100 net/core/sock.c:3253
lock_sock include/net/sock.h:1678 [inline]
sco_conn_ready net/bluetooth/sco.c:1110 [inline]
sco_connect_cfm+0x146/0xad0 net/bluetooth/sco.c:1201
hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline]
hci_sync_conn_complete_evt+0x4ce/0x9b0 net/bluetooth/hci_event.c:4551
hci_event_packet+0xa12/0x1550 net/bluetooth/hci_event.c:6483
hci_rx_work+0x232/0x990 net/bluetooth/hci_core.c:5155
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Allocated by task 17819:
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+0xba/0xf0 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:264 [inline]
__kmalloc+0x168/0x300 mm/slub.c:4407
kmalloc include/linux/slab.h:596 [inline]
sk_prot_alloc+0xe0/0x200 net/core/sock.c:1863
sk_alloc+0x35/0x310 net/core/sock.c:1916
sco_sock_alloc net/bluetooth/sco.c:485 [inline]
sco_sock_create+0xb7/0x300 net/bluetooth/sco.c:520
bt_sock_create+0x159/0x220 net/bluetooth/af_bluetooth.c:130
__sock_create+0x460/0x8f0 net/socket.c:1486
sock_create net/socket.c:1542 [inline]
__sys_socket+0x132/0x370 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+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Freed by task 17819:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd8/0x120 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+0xdd/0x160 mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kfree+0xf1/0x270 mm/slub.c:4559
sk_prot_free net/core/sock.c:1899 [inline]
__sk_destruct+0x58e/0x840 net/core/sock.c:1985
sco_sock_release+0x259/0x310 net/bluetooth/sco.c:1098
__sock_release net/socket.c:649 [inline]
sock_close+0xcd/0x230 net/socket.c:1336
__fput+0x3fe/0x8e0 fs/file_table.c:280
task_work_run+0x129/0x1a0 kernel/task_work.c:188
get_signal+0x143a/0x14e0 kernel/signal.c:2672
arch_do_signal_or_restart+0xc3/0x1890 arch/x86/kernel/signal.c:867
handle_signal_work kernel/entry/common.c:154 [inline]
exit_to_user_mode_loop+0x97/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+0x5d/0x240 kernel/entry/common.c:307
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
kvfree_call_rcu+0x118/0x8a0 kernel/rcu/tree.c:3596
drop_sysctl_table+0x317/0x460 fs/proc/proc_sysctl.c:1678
unregister_sysctl_table+0x88/0x130 fs/proc/proc_sysctl.c:1716
__addrconf_sysctl_unregister net/ipv6/addrconf.c:7120 [inline]
addrconf_sysctl_unregister net/ipv6/addrconf.c:7148 [inline]
addrconf_ifdown+0x183b/0x1bb0 net/ipv6/addrconf.c:3931
addrconf_notify+0x432/0xf30
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0xd0/0x170 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+0xf1b/0x18f0 net/core/dev.c:11098
ip_tunnel_delete_nets+0x2ed/0x330 net/ipv4/ip_tunnel.c:1151
ops_exit_list net/core/net_namespace.c:177 [inline]
cleanup_net+0x763/0xb60 net/core/net_namespace.c:599
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Second to last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
insert_work+0x54/0x3e0 kernel/workqueue.c:1366
__queue_work+0x963/0xd00 kernel/workqueue.c:1532
queue_work_on+0x14b/0x250 kernel/workqueue.c:1559
nsim_fib_event_nb+0xd6a/0xfa0 drivers/net/netdevsim/fib.c:1032
notifier_call_chain kernel/notifier.c:83 [inline]
atomic_notifier_call_chain+0x15f/0x290 kernel/notifier.c:198
call_fib_notifiers+0x2d/0x60 net/core/fib_notifier.c:35
fib6_del+0x1047/0x1570 net/ipv6/ip6_fib.c:2031
fib6_clean_node+0x2ed/0x5d0 net/ipv6/ip6_fib.c:2193
fib6_walk_continue+0x636/0x8c0 net/ipv6/ip6_fib.c:2115
fib6_walk+0x168/0x2b0 net/ipv6/ip6_fib.c:2163
fib6_clean_tree net/ipv6/ip6_fib.c:2243 [inline]
__fib6_clean_all+0x2f8/0x480 net/ipv6/ip6_fib.c:2259
rt6_sync_down_dev net/ipv6/route.c:4907 [inline]
rt6_disable_ip+0x15d/0x6c0 net/ipv6/route.c:4912
addrconf_ifdown+0x161/0x1bb0 net/ipv6/addrconf.c:3778
addrconf_notify+0x432/0xf30
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0xd0/0x170 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]
dev_close_many+0x37c/0x530 net/core/dev.c:1619
unregister_netdevice_many+0x4b0/0x18f0 net/core/dev.c:11074
unregister_netdevice_queue+0x2e6/0x350 net/core/dev.c:11031
unregister_netdevice include/linux/netdevice.h:3012 [inline]
nsim_destroy+0x44/0x140 drivers/net/netdevsim/netdev.c:382
__nsim_dev_port_del+0x153/0x1b0 drivers/net/netdevsim/dev.c:1349
nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1362 [inline]
nsim_dev_reload_destroy+0x15e/0x240 drivers/net/netdevsim/dev.c:1561
nsim_dev_reload_down+0x103/0x160 drivers/net/netdevsim/dev.c:883
devlink_reload+0x247/0x750 net/core/devlink.c:3963
devlink_pernet_pre_exit+0x1ca/0x350 net/core/devlink.c:11543
ops_pre_exit_list net/core/net_namespace.c:162 [inline]
cleanup_net+0x59c/0xb60 net/core/net_namespace.c:587
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
The buggy address belongs to the object at ffff88807b183000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 140 bytes inside of
2048-byte region [ffff88807b183000, ffff88807b183800)
The buggy address belongs to the page:
page:ffffea0001ec6000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7b180
head:ffffea0001ec6000 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 0000000100000001 ffff888017042000
raw: 0000000000000000 0000000000080008 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 9461, ts 669023132022, free_ts 668960726276
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5423
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
__kmalloc+0x1c9/0x300 mm/slub.c:4403
kmalloc include/linux/slab.h:596 [inline]
kzalloc include/linux/slab.h:721 [inline]
__register_sysctl_table+0xdc/0x1220 fs/proc/proc_sysctl.c:1317
__devinet_sysctl_register+0x1d3/0x2a0 net/ipv4/devinet.c:2588
devinet_sysctl_register+0x13a/0x1a0 net/ipv4/devinet.c:2628
inetdev_init+0x257/0x470 net/ipv4/devinet.c:276
inetdev_event+0x29b/0x1490 net/ipv4/devinet.c:1528
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0xd0/0x170 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+0x145/0x1b0 net/core/dev.c:2044
register_netdevice+0x12e8/0x1720 net/core/dev.c:10392
__ip_tunnel_create+0x2b0/0x370 net/ipv4/ip_tunnel.c:267
ip_tunnel_init_net+0x21f/0x700 net/ipv4/ip_tunnel.c:1098
ops_init+0x35d/0x610 net/core/net_namespace.c:138
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+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
do_slab_free mm/slub.c:3487 [inline]
___cache_free+0xe3/0x100 mm/slub.c:3506
qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
__kmalloc_track_caller+0x11e/0x300 mm/slub.c:4925
kstrdup mm/util.c:60 [inline]
kstrdup_const+0x51/0x90 mm/util.c:83
__kernfs_new_node+0x99/0x750 fs/kernfs/dir.c:589
kernfs_new_node+0x136/0x230 fs/kernfs/dir.c:669
__kernfs_create_file+0x45/0x2e0 fs/kernfs/file.c:985
sysfs_add_file_mode_ns+0x308/0x3e0 fs/sysfs/file.c:317
create_files fs/sysfs/group.c:64 [inline]
internal_create_group+0x573/0xf00 fs/sysfs/group.c:149
internal_create_groups fs/sysfs/group.c:189 [inline]
sysfs_create_groups+0x52/0x110 fs/sysfs/group.c:215
setup_gid_attrs drivers/infiniband/core/sysfs.c:1154 [inline]
ib_setup_port_attrs+0x16bf/0x2340 drivers/infiniband/core/sysfs.c:1431
Memory state around the buggy address:
ffff88807b182f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807b183000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807b183080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807b183100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807b183180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================