--- 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)