From: Vinicius Costa Gomes Date: Mon, 11 Apr 2011 21:46:55 +0000 (-0300) Subject: Bluetooth: Fix keeping the command timer running X-Git-Tag: v2.6.39-rc6~7^2~6^2~8^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b79f44c16a4e2181b1d6423afe746745d5e949ff;p=platform%2Fkernel%2Flinux-3.10.git 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 Signed-off-by: Vinicius Costa Gomes Signed-off-by: Gustavo F. Padovan --- diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 2216620..e7dced9 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -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; } @@ -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; }