Skip to contentSkip to conversation

Bluetooth: btintel_pcie: fix TX descriptor bounds check

PATCH Superseded Ravindra 2 participants 3 messages Sep 28 Bluetooth drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ravindra

author
#0 lore raw

PATCH 1/1 Bluetooth: btintel_pcie: fix TX descriptor bounds check

btintel_pcie_prepare_tx() uses tfd_index to access the TFD and data buffer arrays before the index is advanced modulo txq->count. An index equal to txq->count is one past the end of both arrays, so reject it in the bounds check.

---
 drivers/bluetooth/btintel_pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btintel_pcie.c +1 -1
index 59cf600014bb..aaf409a9afb1 100644
@@ -536,7 +536,7 @@ static int btintel_pcie_send_sync(struct btintel_pcie_data *data,
 
 	tfd_index = data->ia.tr_hia[BTINTEL_PCIE_TXQ_NUM];
 
-	if (tfd_index > txq->count)
+	if (tfd_index >= txq->count)
 		return -ERANGE;
 
 	if (skb->len > BTINTEL_PCIE_BUFFER_SIZE - BTINTEL_PCIE_HCI_TYPE_LEN) {
Signature · 1 line
2.43.0
author
#1 lore raw

Adding Kiran and Chethan to the thread for visibility. The patch was sent earlier; no resend is needed.

Quoted 28 lines

Subject: [PATCH] Bluetooth: btintel_pcie: fix TX descriptor bounds check

btintel_pcie_prepare_tx() uses tfd_index to access the TFD and data buffer arrays before the index is advanced modulo txq->count. An index equal to txq->count is one past the end of both arrays, so reject it in the bounds check.

---
 drivers/bluetooth/btintel_pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btintel_pcie.c +1 -1
index 59cf600014bb..aaf409a9afb1 100644
@@ -536,7 +536,7 @@ static int btintel_pcie_send_sync(struct
 btintel_pcie_data *data,
 
 	tfd_index = data->ia.tr_hia[BTINTEL_PCIE_TXQ_NUM];
 
-	if (tfd_index > txq->count)
+	if (tfd_index >= txq->count)
 		return -ERANGE;
 

if (skb->len > BTINTEL_PCIE_BUFFER_SIZE -
BTINTEL_PCIE_HCI_TYPE_LEN) {
--
2.43.0

#2 lore raw
In reply to Ravindra

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/series/1174948/

---Test result---

Test Summary:

CheckPatch                    PASS      0.79 seconds
VerifyFixes                   PASS      0.14 seconds
VerifySignedoff               PASS      0.14 seconds
GitLint                       PASS      0.38 seconds
SubjectPrefix                 PASS      0.14 seconds
BuildKernel                   PASS      30.14 seconds
CheckAllWarning               PASS      33.86 seconds
CheckSparse                   PASS      36.14 seconds
BuildKernel32                 PASS      29.54 seconds
CheckKernelLLVM               PASS      41.81 seconds
TestRunnerSetup               PASS      815.90 seconds
IncrementalBuild              PASS      29.95 seconds

https://github.com/bluez/bluetooth-next/pull/832

---
Regards,
Linux Bluetooth