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>

authored by Vinicius Costa Gomes and committed by Gustavo F. Padovan b79f44c1 7a74aeb0

+2 -3
+2 -3
net/bluetooth/hci_core.c
··· 587 587 hci_req_cancel(hdev, ENODEV); 588 588 hci_req_lock(hdev); 589 589 590 - /* Stop timer, it might be running */ 591 - del_timer_sync(&hdev->cmd_timer); 592 - 593 590 if (!test_and_clear_bit(HCI_UP, &hdev->flags)) { 591 + del_timer_sync(&hdev->cmd_timer); 594 592 hci_req_unlock(hdev); 595 593 return 0; 596 594 } ··· 627 629 628 630 /* Drop last sent command */ 629 631 if (hdev->sent_cmd) { 632 + del_timer_sync(&hdev->cmd_timer); 630 633 kfree_skb(hdev->sent_cmd); 631 634 hdev->sent_cmd = NULL; 632 635 }