[PATCH] Bluetooth: hci_sync: cancel cmd_timer if hci_open failed

From: Archie Pusaka
Date: Wed Oct 05 2022 - 03:10:06 EST


From: Archie Pusaka <apusaka@xxxxxxxxxxxx>

If a command is already sent, we take care of freeing it, but we
also need to cancel the timeout as well.

Signed-off-by: Archie Pusaka <apusaka@xxxxxxxxxxxx>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxx>

---

net/bluetooth/hci_sync.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 76c3107c9f91..a011065220e4 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4696,6 +4696,7 @@ int hci_dev_open_sync(struct hci_dev *hdev)
hdev->flush(hdev);

if (hdev->sent_cmd) {
+ cancel_delayed_work_sync(&hdev->cmd_timer);
kfree_skb(hdev->sent_cmd);
hdev->sent_cmd = NULL;
}
--
2.38.0.rc1.362.ged0d419d3c-goog