* [PATCH v2] Bluetooth: hci_event: Detect if HCI_EV_NUM_COMP_PKTS is unbalanced
@ 2025-08-21 13:47 Luiz Augusto von Dentz
2025-08-21 14:19 ` [v2] " bluez.test.bot
2025-08-22 14:40 ` [PATCH v2] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2025-08-21 13:47 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
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.
Fixes: f42809185896 ("Bluetooth: Simplify num_comp_pkts_evt function")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
net/bluetooth/hci_event.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 512041c68062..dc946c5b59d8 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -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);
--
2.50.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [v2] Bluetooth: hci_event: Detect if HCI_EV_NUM_COMP_PKTS is unbalanced
2025-08-21 13:47 [PATCH v2] Bluetooth: hci_event: Detect if HCI_EV_NUM_COMP_PKTS is unbalanced Luiz Augusto von Dentz
@ 2025-08-21 14:19 ` bluez.test.bot
2025-08-22 14:40 ` [PATCH v2] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-08-21 14:19 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 2497 bytes --]
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Bluetooth: hci_event: Detect if HCI_EV_NUM_COMP_PKTS is unbalanced
2025-08-21 13:47 [PATCH v2] Bluetooth: hci_event: Detect if HCI_EV_NUM_COMP_PKTS is unbalanced Luiz Augusto von Dentz
2025-08-21 14:19 ` [v2] " bluez.test.bot
@ 2025-08-22 14:40 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-08-22 14:40 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 21 Aug 2025 09:47:14 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> 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.
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-22 14:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-21 13:47 [PATCH v2] Bluetooth: hci_event: Detect if HCI_EV_NUM_COMP_PKTS is unbalanced Luiz Augusto von Dentz
2025-08-21 14:19 ` [v2] " bluez.test.bot
2025-08-22 14:40 ` [PATCH v2] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).