@@ -1481,17 +1481,25 @@ static void hci_cmd_timeout(struct work_struct *work)
struct hci_dev *hdev = container_of(work, struct hci_dev,
cmd_timer.work);
- if (hdev->sent_cmd) {
- struct hci_command_hdr *sent = (void *) hdev->sent_cmd->data;
- u16 opcode = __le16_to_cpu(sent->opcode);
+ /* Don't trigger the timeout behavior if it happens while we're in
+ * userchannel mode. Userspace is responsible for handling any command
+ * timeouts.
+ */
+ if (!(hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
+ test_bit(HCI_UP, &hdev->flags))) {
+ if (hdev->sent_cmd) {
+ struct hci_command_hdr *sent =
+ (void *)hdev->sent_cmd->data;
+ u16 opcode = __le16_to_cpu(sent->opcode);
- bt_dev_err(hdev, "command 0x%4.4x tx timeout", opcode);
- } else {
- bt_dev_err(hdev, "command tx timeout");
- }
+ bt_dev_err(hdev, "command 0x%4.4x tx timeout", opcode);
+ } else {
+ bt_dev_err(hdev, "command tx timeout");
+ }
- if (hdev->cmd_timeout)
- hdev->cmd_timeout(hdev);
+ if (hdev->cmd_timeout)
+ hdev->cmd_timeout(hdev);
+ }
atomic_set(&hdev->cmd_cnt, 1);
queue_work(hdev->workqueue, &hdev->cmd_work);