From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Li Qiang <liqiang01@kylinos.cn>, linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, luiz.dentz@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] Bluetooth: btmrvl: validate event packet lengths
Date: Tue, 4 Aug 2026 11:54:20 +0200 [thread overview]
Message-ID: <0eec0c0d-636b-4e41-b578-72692b920a2e@samsung.com> (raw)
In-Reply-To: <628bdb80b4ae352606d6cfb175180c980a8c362a.1784191283.git.liqiang01@kylinos.cn>
On 16.07.2026 10:47, Li Qiang wrote:
> The Marvell event handlers access the HCI event header, command
> complete payload, and driver-specific event header before validating
> that the received skb contains them. A truncated event can consequently
> cause an out-of-bounds read.
>
> Validate each header and the command-complete payload length before
> dereferencing the corresponding fields.
>
> Signed-off-by: Li Qiang <liqiang01@kylinos.cn>
This patch landed in linux-next as commit 75e574f6a212 ("Bluetooth: btmrvl:
validate event packet lengths"). In my tests I found that it breaks bluetooth
driver operation on old Samsung Exynos SoC based Peach Pit/Pi Chromebooks.
I've sent a fix for this issue here:
https://lore.kernel.org/all/20260804094632.87581-1-m.szyprowski@samsung.com/
> ---
> drivers/bluetooth/btmrvl_main.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
> index d6f0ad0b4b6e..aaf1614ccfd7 100644
> --- a/drivers/bluetooth/btmrvl_main.c
> +++ b/drivers/bluetooth/btmrvl_main.c
> @@ -43,10 +43,17 @@ bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb)
> {
> struct hci_event_hdr *hdr = (void *) skb->data;
>
> + if (skb->len < sizeof(*hdr))
> + return true;
> +
> if (hdr->evt == HCI_EV_CMD_COMPLETE) {
> struct hci_ev_cmd_complete *ec;
> u16 opcode;
>
> + if (hdr->plen < sizeof(*ec) ||
> + skb->len < HCI_EVENT_HDR_SIZE + sizeof(*ec))
> + return true;
> +
> ec = (void *) (skb->data + HCI_EVENT_HDR_SIZE);
> opcode = __le16_to_cpu(ec->opcode);
>
> @@ -74,6 +81,9 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
> struct btmrvl_event *event;
> int ret = 0;
>
> + if (skb->len < sizeof(*event))
> + return -EINVAL;
> +
> event = (struct btmrvl_event *) skb->data;
> if (event->ec != 0xff) {
> BT_DBG("Not Marvell Event=%x", event->ec);
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2026-08-04 9:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 8:47 [PATCH 0/5] Bluetooth: harden packet and transport parsing Li Qiang
2026-07-16 8:47 ` [PATCH 1/5] Bluetooth: bfusb: validate received block boundaries Li Qiang
2026-07-16 10:29 ` Bluetooth: harden packet and transport parsing bluez.test.bot
2026-07-16 8:47 ` [PATCH 2/5] Bluetooth: btmrvl: validate event packet lengths Li Qiang
2026-08-04 9:54 ` Marek Szyprowski [this message]
2026-07-16 8:47 ` [PATCH 3/5] Bluetooth: hci_bcsp: validate received " Li Qiang
2026-07-16 8:47 ` [PATCH 4/5] Bluetooth: hci_ldisc: reject invalid tty write lengths Li Qiang
2026-07-16 8:47 ` [PATCH 5/5] Bluetooth: hci_qca: validate controller memdump frames Li Qiang
2026-07-20 20:20 ` [PATCH 0/5] Bluetooth: harden packet and transport parsing patchwork-bot+bluetooth
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=0eec0c0d-636b-4e41-b578-72692b920a2e@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liqiang01@kylinos.cn \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/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