* [PATCH] Bluetooth: btintel_pcie: fix off-by-one in RX queue bounds check
@ 2026-03-24 13:26 Junrui Luo
2026-03-24 14:41 ` bluez.test.bot
2026-03-24 15:06 ` [PATCH] " Luiz Augusto von Dentz
0 siblings, 2 replies; 3+ messages in thread
From: Junrui Luo @ 2026-03-24 13:26 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Tedd Ho-Jeong An,
Kiran K
Cc: Luiz Augusto von Dentz, linux-bluetooth, linux-kernel,
Yuhao Jiang, stable, Junrui Luo
btintel_pcie_submit_rx() reads frbd_index and validates it against
rxq->count. Since rxq->frbds[] and rxq->bufs[] are allocated with
rxq->count entries, valid indices are 0 to rxq->count - 1. The current
check uses > instead of >=, allowing frbd_index == rxq->count through.
This causes an out-of-bounds access in btintel_pcie_prepare_rx() when
writing to rxq->bufs[frbd_index] and rxq->frbds[frbd_index].
Fix by using >= so that frbd_index == rxq->count is correctly rejected.
Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Reported-by: Yuhao Jiang <danisjiang@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
---
drivers/bluetooth/btintel_pcie.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 37b744e35bc4..cbadcfe86321 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -460,7 +460,7 @@ static int btintel_pcie_submit_rx(struct btintel_pcie_data *data)
frbd_index = data->ia.tr_hia[BTINTEL_PCIE_RXQ_NUM];
- if (frbd_index > rxq->count)
+ if (frbd_index >= rxq->count)
return -ERANGE;
/* Prepare for RX submit. It updates the FRBD with the address of DMA
---
base-commit: c369299895a591d96745d6492d4888259b004a9e
change-id: 20260324-fixes-8c301e8881f0
Best regards,
--
Junrui Luo <moonafterrain@outlook.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: btintel_pcie: fix off-by-one in RX queue bounds check
2026-03-24 13:26 [PATCH] Bluetooth: btintel_pcie: fix off-by-one in RX queue bounds check Junrui Luo
@ 2026-03-24 14:41 ` bluez.test.bot
2026-03-24 15:06 ` [PATCH] " Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-03-24 14:41 UTC (permalink / raw)
To: linux-bluetooth, moonafterrain
[-- Attachment #1: Type: text/plain, Size: 2913 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=1071681
---Test result---
Test Summary:
CheckPatch PENDING 0.59 seconds
GitLint PENDING 0.33 seconds
SubjectPrefix PASS 0.10 seconds
BuildKernel PASS 27.00 seconds
CheckAllWarning PASS 29.30 seconds
CheckSparse PASS 28.00 seconds
BuildKernel32 PASS 26.06 seconds
TestRunnerSetup PASS 578.23 seconds
TestRunner_l2cap-tester PASS 28.23 seconds
TestRunner_iso-tester FAIL 37.46 seconds
TestRunner_bnep-tester PASS 6.51 seconds
TestRunner_mgmt-tester FAIL 137.01 seconds
TestRunner_rfcomm-tester PASS 9.83 seconds
TestRunner_sco-tester FAIL 14.82 seconds
TestRunner_ioctl-tester PASS 10.45 seconds
TestRunner_mesh-tester FAIL 12.67 seconds
TestRunner_smp-tester PASS 8.82 seconds
TestRunner_userchan-tester PASS 6.89 seconds
IncrementalBuild PENDING 0.51 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
BUG: KASAN: slab-use-after-free in le_read_features_complete+0x7e/0x2b0
Total: 141, Passed: 141 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 488 (98.8%), Failed: 2, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.112 seconds
LL Privacy - Set Flags 3 (2 Devices to RL) Failed 0.204 seconds
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
BUG: sleeping function called from invalid context at net/core/sock.c:3782
Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0
##############################
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 2.724 seconds
Mesh - Send cancel - 2 Timed out 1.994 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] Bluetooth: btintel_pcie: fix off-by-one in RX queue bounds check
2026-03-24 13:26 [PATCH] Bluetooth: btintel_pcie: fix off-by-one in RX queue bounds check Junrui Luo
2026-03-24 14:41 ` bluez.test.bot
@ 2026-03-24 15:06 ` Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2026-03-24 15:06 UTC (permalink / raw)
To: Junrui Luo
Cc: Marcel Holtmann, Tedd Ho-Jeong An, Kiran K,
Luiz Augusto von Dentz, linux-bluetooth, linux-kernel,
Yuhao Jiang, stable
Hi @Kiran K
On Tue, Mar 24, 2026 at 9:27 AM Junrui Luo <moonafterrain@outlook.com> wrote:
>
> btintel_pcie_submit_rx() reads frbd_index and validates it against
> rxq->count. Since rxq->frbds[] and rxq->bufs[] are allocated with
> rxq->count entries, valid indices are 0 to rxq->count - 1. The current
> check uses > instead of >=, allowing frbd_index == rxq->count through.
>
> This causes an out-of-bounds access in btintel_pcie_prepare_rx() when
> writing to rxq->bufs[frbd_index] and rxq->frbds[frbd_index].
>
> Fix by using >= so that frbd_index == rxq->count is correctly rejected.
>
> Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
> Reported-by: Yuhao Jiang <danisjiang@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
> ---
> drivers/bluetooth/btintel_pcie.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
> index 37b744e35bc4..cbadcfe86321 100644
> --- a/drivers/bluetooth/btintel_pcie.c
> +++ b/drivers/bluetooth/btintel_pcie.c
> @@ -460,7 +460,7 @@ static int btintel_pcie_submit_rx(struct btintel_pcie_data *data)
>
> frbd_index = data->ia.tr_hia[BTINTEL_PCIE_RXQ_NUM];
>
> - if (frbd_index > rxq->count)
> + if (frbd_index >= rxq->count)
> return -ERANGE;
>
> /* Prepare for RX submit. It updates the FRBD with the address of DMA
>
> ---
> base-commit: c369299895a591d96745d6492d4888259b004a9e
> change-id: 20260324-fixes-8c301e8881f0
>
> Best regards,
> --
> Junrui Luo <moonafterrain@outlook.com>
This one seems valid as well.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-24 15:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 13:26 [PATCH] Bluetooth: btintel_pcie: fix off-by-one in RX queue bounds check Junrui Luo
2026-03-24 14:41 ` bluez.test.bot
2026-03-24 15:06 ` [PATCH] " Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox