Bluetooth: hci_event: Detect if HCI_EV_NUM_COMP_PKTS is unbalanced
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH v2 1/1 Bluetooth: hci_event: Detect if HCI_EV_NUM_COMP_PKTS is unbalanced
From: Luiz Augusto von Dentz <[email protected]>
This attempts to detect if HCI_EV_NUM_COMP_PKTS contain an unbalanced (more than currently considered outstanding) number of packets otherwise it could cause the hcon->sent to underflow and loop around breaking the tracking of the outstanding packets pending acknowledgment.
--- net/bluetooth/hci_event.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
net/bluetooth/hci_event.c +11 -1
@@ -4414,7 +4414,17 @@ static void hci_num_comp_pkts_evt(struct hci_dev *hdev, void *data,if (!conn)continue ; - conn->sent -= count; +/* Check if there is really enough packets outstanding before +* attempting to decrease the sent counter otherwise it could +* underflow.. +*/ +if (conn->sent >= count) { + conn->sent -= count; + }else { +bt_dev_warn (hdev,"hcon %p sent %u < count %u" , + conn, conn->sent, count); + conn->sent =0 ; + }for (i =0 ; i < count; ++i)hci_conn_tx_dequeue (conn);
Signature · 1 line
2.50.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=994058
---Test result---
Test Summary:
CheckPatch PENDING 0.43 seconds GitLint PENDING 0.40 seconds SubjectPrefix PASS 0.06 seconds BuildKernel PASS 24.12 seconds CheckAllWarning PASS 26.63 seconds CheckSparse WARNING 29.93 seconds BuildKernel32 PASS 24.29 seconds TestRunnerSetup PASS 485.93 seconds TestRunner_l2cap-tester PASS 25.76 seconds TestRunner_iso-tester PASS 41.22 seconds TestRunner_bnep-tester PASS 6.21 seconds TestRunner_mgmt-tester FAIL 131.90 seconds TestRunner_rfcomm-tester PASS 9.67 seconds TestRunner_sco-tester PASS 15.02 seconds TestRunner_ioctl-tester PASS 10.43 seconds TestRunner_mesh-tester FAIL 11.63 seconds TestRunner_smp-tester PASS 8.88 seconds TestRunner_userchan-tester PASS 6.50 seconds IncrementalBuild PENDING 1.01 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.112 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 1.893 seconds Mesh - Send cancel - 2 Timed out 1.997 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Thu, 21 Aug 2025 09:47:14 -0400 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This attempts to detect if
HCI_EV_NUM_COMP_PKTScontain an unbalanced (more than currently considered outstanding) number of packets otherwise it could cause thehcon->sentto underflow and loop around breaking the tracking of the outstanding packets pending acknowledgment.[...]
Here is the summary with links:
- [v2] Bluetooth: hci_event: Detect if HCI_EV_NUM_COMP_PKTS is unbalanced
https://git.kernel.org/bluetooth/bluetooth-next/c/05be312ba55c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html