possible deadlock in hci_dev_do_close (2)

8 views
Skip to first unread message

syzbot

unread,
Jan 12, 2022, 2:44:27 PM1/12/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 4ba8e26127c3 Linux 4.14.262
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12df0817b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=51e11aabddb4cf62
dashboard link: https://syzkaller.appspot.com/bug?extid=bc26aee76044cf5f809e
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+bc26ae...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
4.14.262-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/13068 is trying to acquire lock:
("%s"hdev->name#2){+.+.}, at: [<ffffffff81367967>] start_flush_work kernel/workqueue.c:2861 [inline]
("%s"hdev->name#2){+.+.}, at: [<ffffffff81367967>] flush_work+0x387/0x770 kernel/workqueue.c:2893

but task is already holding lock:
(&hdev->lock){+.+.}, at: [<ffffffff86612904>] hci_dev_do_close+0x264/0xd80 net/bluetooth/hci_core.c:1628

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&hdev->lock){+.+.}:
__mutex_lock_common kernel/locking/mutex.c:756 [inline]
__mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
hci_cc_write_scan_enable net/bluetooth/hci_event.c:375 [inline]
hci_cmd_complete_evt+0x4d34/0xb490 net/bluetooth/hci_event.c:2831
hci_event_packet+0x21ce/0x7510 net/bluetooth/hci_event.c:5346
hci_rx_work+0x427/0xb40 net/bluetooth/hci_core.c:4265
process_one_work+0x793/0x14a0 kernel/workqueue.c:2117
worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

-> #1 ((&hdev->rx_work)){+.+.}:
process_one_work+0x736/0x14a0 kernel/workqueue.c:2093
worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

-> #0 ("%s"hdev->name#2){+.+.}:
lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
start_flush_work kernel/workqueue.c:2862 [inline]
flush_work+0x3ac/0x770 kernel/workqueue.c:2893
__cancel_work_timer+0x321/0x460 kernel/workqueue.c:2965
hci_conn_del+0x52/0x6f0 net/bluetooth/hci_conn.c:575
hci_conn_hash_flush+0x19c/0x260 net/bluetooth/hci_conn.c:1394
hci_dev_do_close+0x57d/0xd80 net/bluetooth/hci_core.c:1641
hci_unregister_dev+0x143/0x420 net/bluetooth/hci_core.c:3208
vhci_release+0x70/0xe0 drivers/bluetooth/hci_vhci.c:354
__fput+0x25f/0x7a0 fs/file_table.c:210
task_work_run+0x11f/0x190 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0xa44/0x2850 kernel/exit.c:868
do_group_exit+0x100/0x2e0 kernel/exit.c:965
get_signal+0x38d/0x1ca0 kernel/signal.c:2412
do_signal+0x7c/0x1550 arch/x86/kernel/signal.c:792
exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x46/0xbb

other info that might help us debug this:

Chain exists of:
"%s"hdev->name#2 --> (&hdev->rx_work) --> &hdev->lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&hdev->lock);
lock((&hdev->rx_work));
lock(&hdev->lock);
lock("%s"hdev->name#2);

*** DEADLOCK ***

2 locks held by syz-executor.0/13068:
#0: (&hdev->req_lock){+.+.}, at: [<ffffffff86612748>] hci_dev_do_close+0xa8/0xd80 net/bluetooth/hci_core.c:1589
#1: (&hdev->lock){+.+.}, at: [<ffffffff86612904>] hci_dev_do_close+0x264/0xd80 net/bluetooth/hci_core.c:1628

stack backtrace:
CPU: 0 PID: 13068 Comm: syz-executor.0 Not tainted 4.14.262-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
check_prev_add kernel/locking/lockdep.c:1905 [inline]
check_prevs_add kernel/locking/lockdep.c:2022 [inline]
validate_chain kernel/locking/lockdep.c:2464 [inline]
__lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
start_flush_work kernel/workqueue.c:2862 [inline]
flush_work+0x3ac/0x770 kernel/workqueue.c:2893
__cancel_work_timer+0x321/0x460 kernel/workqueue.c:2965
hci_conn_del+0x52/0x6f0 net/bluetooth/hci_conn.c:575
hci_conn_hash_flush+0x19c/0x260 net/bluetooth/hci_conn.c:1394
hci_dev_do_close+0x57d/0xd80 net/bluetooth/hci_core.c:1641
hci_unregister_dev+0x143/0x420 net/bluetooth/hci_core.c:3208
vhci_release+0x70/0xe0 drivers/bluetooth/hci_vhci.c:354
__fput+0x25f/0x7a0 fs/file_table.c:210
task_work_run+0x11f/0x190 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0xa44/0x2850 kernel/exit.c:868
do_group_exit+0x100/0x2e0 kernel/exit.c:965
get_signal+0x38d/0x1ca0 kernel/signal.c:2412
do_signal+0x7c/0x1550 arch/x86/kernel/signal.c:792
exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f7d2921eeb9
RSP: 002b:00007f7d27b73218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007f7d29332038 RCX: 00007f7d2921eeb9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f7d29332038
RBP: 00007f7d29332030 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f7d2933203c
R13: 00007ffd85113ccf R14: 00007f7d27b73300 R15: 0000000000022000


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
May 12, 2022, 3:44:38 PM5/12/22
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages