Skip to content

Commit

Permalink
Bluetooth: Fix keeping the command timer running
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vinicius Costa Gomes authored and Gustavo F. Padovan committed Apr 18, 2011
1 parent 7a74aeb commit b79f44c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
hci_req_cancel(hdev, ENODEV);
hci_req_lock(hdev);

/* Stop timer, it might be running */
del_timer_sync(&hdev->cmd_timer);

if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
del_timer_sync(&hdev->cmd_timer);
hci_req_unlock(hdev);
return 0;
}
Expand Down Expand Up @@ -629,6 +627,7 @@ static int hci_dev_do_close(struct hci_dev *hdev)

/* Drop last sent command */
if (hdev->sent_cmd) {
del_timer_sync(&hdev->cmd_timer);
kfree_skb(hdev->sent_cmd);
hdev->sent_cmd = NULL;
}
Expand Down

0 comments on commit b79f44c

Please sign in to comment.