public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Junrui Luo <moonafterrain@outlook.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Tedd Ho-Jeong An <tedd.an@intel.com>, Kiran K <kiran.k@intel.com>,
	 Luiz Augusto von Dentz <luiz.von.dentz@intel.com>,
	linux-bluetooth@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Yuhao Jiang <danisjiang@gmail.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: btintel_pcie: fix off-by-one in RX queue bounds check
Date: Tue, 24 Mar 2026 11:06:41 -0400	[thread overview]
Message-ID: <CABBYNZ+Mo-UWu3Z-rg2JMzEbU=GXB3bizVcGqyJnkUfkJabAAg@mail.gmail.com> (raw)
In-Reply-To: <SYBPR01MB7881B5254647551279894DCDAF48A@SYBPR01MB7881.ausprd01.prod.outlook.com>

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

      reply	other threads:[~2026-03-24 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 13:26 [PATCH] Bluetooth: btintel_pcie: fix off-by-one in RX queue bounds check Junrui Luo
2026-03-24 15:06 ` Luiz Augusto von Dentz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABBYNZ+Mo-UWu3Z-rg2JMzEbU=GXB3bizVcGqyJnkUfkJabAAg@mail.gmail.com' \
    --to=luiz.dentz@gmail.com \
    --cc=danisjiang@gmail.com \
    --cc=kiran.k@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.von.dentz@intel.com \
    --cc=marcel@holtmann.org \
    --cc=moonafterrain@outlook.com \
    --cc=stable@vger.kernel.org \
    --cc=tedd.an@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox