Re: [syzbot] [bluetooth?] possible deadlock in touch_wq_lockdep_map

From: Hillf Danton
Date: Wed Jul 03 2024 - 06:27:09 EST


On Tue, 02 Jul 2024 18:47:23 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 734610514cb0 Merge tag 'erofs-for-6.10-rc7-fixes' of git:/..
> git tree: upstream
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1424d281980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 734610514cb0

--- x/net/bluetooth/hci_core.c
+++ y/net/bluetooth/hci_core.c
@@ -1075,6 +1075,7 @@ static void hci_power_off(struct work_st
static void hci_error_reset(struct work_struct *work)
{
struct hci_dev *hdev = container_of(work, struct hci_dev, error_reset);
+ bool put;

hci_dev_hold(hdev);
BT_DBG("%s", hdev->name);
@@ -1084,10 +1085,13 @@ static void hci_error_reset(struct work_
else
bt_dev_err(hdev, "hardware error 0x%2.2x", hdev->hw_error_code);

+ put = !test_bit(HCI_UP, &hdev->flags);
+
if (!hci_dev_do_close(hdev))
hci_dev_do_open(hdev);

- hci_dev_put(hdev);
+ if (put)
+ hci_dev_put(hdev);
}

void hci_uuids_clear(struct hci_dev *hdev)
--