Skip to content

Commit b79f44c

Browse files
vcgomesGustavo F. Padovan
authored andcommitted
Bluetooth: Fix keeping the command timer running
In the teardown path the reset command is sent to the controller, this event causes the command timer to be reactivated. So the timer is removed in two situations, when the adapter isn't marked as UP and when we know that some command has been sent. Reported-by: Keith Packard <keithp@keithp.com> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
1 parent 7a74aeb commit b79f44c

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎net/bluetooth/hci_core.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
587587
hci_req_cancel(hdev, ENODEV);
588588
hci_req_lock(hdev);
589589

590-
/* Stop timer, it might be running */
591-
del_timer_sync(&hdev->cmd_timer);
592-
593590
if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
591+
del_timer_sync(&hdev->cmd_timer);
594592
hci_req_unlock(hdev);
595593
return 0;
596594
}
@@ -629,6 +627,7 @@ static int hci_dev_do_close(struct hci_dev *hdev)
629627

630628
/* Drop last sent command */
631629
if (hdev->sent_cmd) {
630+
del_timer_sync(&hdev->cmd_timer);
632631
kfree_skb(hdev->sent_cmd);
633632
hdev->sent_cmd = NULL;
634633
}

0 commit comments

Comments
 (0)