Linux bluetooth development
 help / color / mirror / Atom feed
From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Kiran K <kiran.k@intel.com>
Cc: ravishankar.srivatsa@intel.com, chethan.tumkur.narayan@intel.com,
	chandrashekar.devegowda@intel.com,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v1 1/2] Bluetooth: btintel_pcie: validate packet_len before skb_put_data
Date: Thu, 3 Sep 2026 09:27:39 +0200	[thread overview]
Message-ID: <f97c5109-2620-4f41-bb9a-cc569bc599b9@molgen.mpg.de> (raw)
In-Reply-To: <20260902131830.35502-1-kiran.k@intel.com>

Dear Kiran,


Thank you for your patch.

Am 02.09.26 um 15:18 schrieb Kiran K:
> btintel_pcie_submit_rx_work() reads packet_len from rfh_hdr without
> checking if it exceeds the RX buffer size. An oversized packet_len
> can lead to an out-of-bounds read in skb_put_data().
> 
> Validate packet_len to ensure it is non-zero and does not exceed
> BTINTEL_PCIE_BUFFER_SIZE - sizeof(*rfh_hdr), logging an error when
> invalid.

Can this case be forced somehow? Please document how.

Did a tool find this case or did you experience it during 
testing/review? If a tool, please document it.

> Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
> Signed-off-by: Kiran K <kiran.k@intel.com>
> ---
>   drivers/bluetooth/btintel_pcie.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
> index 30923eaabed7..1eabb0c8326f 100644
> --- a/drivers/bluetooth/btintel_pcie.c
> +++ b/drivers/bluetooth/btintel_pcie.c
> @@ -1954,7 +1954,8 @@ static int btintel_pcie_submit_rx_work(struct btintel_pcie_data *data, u8 status
>   	rfh_hdr = buf;
>   
>   	len = rfh_hdr->packet_len;
> -	if (len <= 0) {
> +	if (len == 0 || len > BTINTEL_PCIE_BUFFER_SIZE - sizeof(*rfh_hdr)) {
> +		bt_dev_err(data->hdev, "Invalid packet_len %d", len);

What about negative values for `len` as was checked before?

To have a more useful log, I’d also log the value of 
`BTINTEL_PCIE_BUFFER_SIZE` and `sizeof(*rfh_hdr)`.

>   		ret = -EINVAL;
>   		goto resubmit;
>   	}


Kind regards,

Paul

  parent reply	other threads:[~2026-09-03  7:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 13:18 [PATCH v1 1/2] Bluetooth: btintel_pcie: validate packet_len before skb_put_data Kiran K
2026-09-02 13:18 ` [PATCH v1 2/2] Bluetooth: btintel_pcie: fix tx_handle bounds off-by-one Kiran K
2026-09-02 15:50 ` [v1,1/2] Bluetooth: btintel_pcie: validate packet_len before skb_put_data bluez.test.bot
2026-09-03  7:27 ` Paul Menzel [this message]
2026-09-03 13:58   ` [PATCH v1 1/2] " K, Kiran

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=f97c5109-2620-4f41-bb9a-cc569bc599b9@molgen.mpg.de \
    --to=pmenzel@molgen.mpg.de \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=chethan.tumkur.narayan@intel.com \
    --cc=kiran.k@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ravishankar.srivatsa@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