From: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
linux-kernel@vger.kernel.org,
Laxman Acharya Padhya <acharyalaxman8848@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH] Bluetooth: hci_codec: validate vendor codec count length
Date: Sun, 23 Aug 2026 22:01:38 +0545 [thread overview]
Message-ID: <20260823161638.32348-1-acharyalaxman8848@gmail.com> (raw)
The Read Local Supported Codecs parsers consume the variable-sized
standard codec array before parsing the vendor codec count. Although the
initial reply-size check includes a vendor count byte in the fixed layout,
it does not guarantee that the byte remains after the standard codec array.
If a controller reply ends immediately after that array, calculating the
vendor codec array size reads vnd_codecs->num beyond the skb data. Require
the vendor codec header to be present before using its count in both
command variants.
Fixes: 8961987f3f5f ("Bluetooth: Enumerate local supported codec and cache details")
Fixes: 9ae664028a9e ("Bluetooth: Add support for Read Local Supported Codecs V2")
Cc: stable@vger.kernel.org
Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
---
net/bluetooth/hci_codec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/hci_codec.c b/net/bluetooth/hci_codec.c
index 5bc5003c387c..99394a3348c7 100644
--- a/net/bluetooth/hci_codec.c
+++ b/net/bluetooth/hci_codec.c
@@ -165,6 +165,8 @@ void hci_read_supported_codecs(struct hci_dev *hdev)
+ sizeof(std_codecs->num));
vnd_codecs = (void *)skb->data;
+ if (skb->len < sizeof(*vnd_codecs))
+ goto error;
/* validate vendor codecs length before accessing */
if (skb->len <
@@ -233,6 +235,8 @@ void hci_read_supported_codecs_v2(struct hci_dev *hdev)
+ sizeof(std_codecs->num));
vnd_codecs = (void *)skb->data;
+ if (skb->len < sizeof(*vnd_codecs))
+ goto error;
/* check for payload data length before accessing */
if (skb->len <
--
2.50.1
next reply other threads:[~2026-08-23 16:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 16:16 Laxman Acharya Padhya [this message]
2026-08-23 17:18 ` Bluetooth: hci_codec: validate vendor codec count length bluez.test.bot
2026-08-24 14:28 ` [PATCH] " Luiz Augusto von Dentz
2026-08-24 14:40 ` Laxman Acharya Padhya
2026-08-24 15:01 ` Luiz Augusto von Dentz
2026-08-24 15:20 ` Laxman Acharya Padhya
2026-08-24 15:31 ` Luiz Augusto von Dentz
2026-08-24 15:57 ` [PATCH v2] " Laxman Acharya Padhya
2026-08-24 16:54 ` [v2] " bluez.test.bot
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=20260823161638.32348-1-acharyalaxman8848@gmail.com \
--to=acharyalaxman8848@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=stable@vger.kernel.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