diff mbox series

[v1] Bluetooth: hci_core: Complete request if command timeout

Message ID 20240109190905.546266-1-luiz.dentz@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v1] Bluetooth: hci_core: Complete request if command timeout | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz Jan. 9, 2024, 7:09 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If command has timeout notify the hci_req since it will inevitably cause
a timeout.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/hci_core.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Jan. 9, 2024, 8:09 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=815513

---Test result---

Test Summary:
CheckPatch                    PASS      1.14 seconds
GitLint                       PASS      0.39 seconds
SubjectPrefix                 PASS      0.13 seconds
BuildKernel                   PASS      27.98 seconds
CheckAllWarning               PASS      30.95 seconds
CheckSparse                   PASS      36.68 seconds
CheckSmatch                   PASS      99.46 seconds
BuildKernel32                 PASS      27.37 seconds
TestRunnerSetup               PASS      435.66 seconds
TestRunner_l2cap-tester       PASS      23.00 seconds
TestRunner_iso-tester         PASS      45.38 seconds
TestRunner_bnep-tester        PASS      6.89 seconds
TestRunner_mgmt-tester        PASS      158.89 seconds
TestRunner_rfcomm-tester      PASS      11.31 seconds
TestRunner_sco-tester         PASS      14.51 seconds
TestRunner_ioctl-tester       PASS      11.97 seconds
TestRunner_mesh-tester        PASS      8.69 seconds
TestRunner_smp-tester         PASS      9.79 seconds
TestRunner_userchan-tester    PASS      7.22 seconds
IncrementalBuild              PASS      26.62 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e5cb618fa6d3..acf4d99cd8fc 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1523,10 +1523,21 @@  static void hci_cmd_timeout(struct work_struct *work)
 					    cmd_timer.work);
 
 	if (hdev->sent_cmd) {
-		struct hci_command_hdr *sent = (void *) hdev->sent_cmd->data;
-		u16 opcode = __le16_to_cpu(sent->opcode);
+		u16 opcode = hci_skb_opcode(hdev->sent_cmd);
+		u8 status = HCI_ERROR_CONNECTION_TIMEOUT;
+		hci_req_complete_t req_complete = NULL;
+		hci_req_complete_skb_t req_complete_skb = NULL;
 
 		bt_dev_err(hdev, "command 0x%4.4x tx timeout", opcode);
+
+		hci_req_cmd_complete(hdev, opcode, status, &req_complete,
+				     &req_complete_skb);
+
+		/* Notify hci_req the command has timed out */
+		if (req_complete)
+			req_complete(hdev, status, opcode);
+		else if (req_complete_skb)
+			req_complete_skb(hdev, status, opcode, NULL);
 	} else {
 		bt_dev_err(hdev, "command tx timeout");
 	}