--- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1726,8 +1726,15 @@ } cancel_delayed_work(&conn->disc_work); - queue_delayed_work(conn->hdev->workqueue, - &conn->disc_work, timeo); + + /* Pairs with synchronize_rcu() in hci_dev_close_sync(): don't + * queue disc_work while hdev->workqueue is being drained. + */ + rcu_read_lock(); + if (!hci_dev_test_flag(conn->hdev, HCI_CMD_DRAIN_WORKQUEUE)) + queue_delayed_work(conn->hdev->workqueue, + &conn->disc_work, timeo); + rcu_read_unlock(); } }