* [PATCH 1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling
@ 2026-07-01 15:46 Pauli Virtanen
2026-07-01 15:46 ` [PATCH 2/2] Bluetooth: ISO: exclude RFU bits from ISO_SDU_Length Pauli Virtanen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Pauli Virtanen @ 2026-07-01 15:46 UTC (permalink / raw)
To: linux-bluetooth
Cc: Pauli Virtanen, marcel, luiz.dentz, devnexen, linux-kernel
Core specification (Part C vol 4 sec 5.4.5) does not exclude empty
ISO_CONT, ISO_END packets. We currently reject them if they are last.
If controller sends malformed sequence
ISO_START -> rx_len = 4, ISO_CONT skb->len 4, ISO_START
that ends payload in ISO_CONT, we leak conn->rx_skb. If controller sends
too long ISO_END, we panic on skb_put. If controller sends too short
ISO_END we accept it.
Fix by marking unfinished ISO_START via conn->rx_skb != NULL. Check
skb->len properly before skb_put. Combine the ISO_CONT/END code paths
as they require the same initial checks. Reject too short ISO_END
packets.
Fixes: 6aba94a49bc9 ("Bluetooth: ISO: drop ISO_END frames received without prior ISO_START")
Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
---
net/bluetooth/iso.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index cd7c7c9ea4fc..2e95a153912c 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -2540,7 +2540,7 @@ int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags)
switch (pb) {
case ISO_START:
case ISO_SINGLE:
- if (conn->rx_len) {
+ if (conn->rx_skb || conn->rx_len) {
BT_ERR("Unexpected start frame (len %d)", skb->len);
kfree_skb(conn->rx_skb);
conn->rx_skb = NULL;
@@ -2621,12 +2621,14 @@ int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags)
break;
case ISO_CONT:
- BT_DBG("Cont: frag len %d (expecting %d)", skb->len,
+ case ISO_END:
+ BT_DBG("%s: frag len %d (expecting %d)",
+ (pb == ISO_END) ? "End" : "Cont", skb->len,
conn->rx_len);
- if (!conn->rx_len) {
- BT_ERR("Unexpected continuation frame (len %d)",
- skb->len);
+ if (!conn->rx_skb) {
+ BT_ERR("Unexpected ISO %s frame (len %d)",
+ (pb == ISO_END) ? "End" : "Cont", skb->len);
goto drop;
}
@@ -2642,17 +2644,9 @@ int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags)
skb_copy_from_linear_data(skb, skb_put(conn->rx_skb, skb->len),
skb->len);
conn->rx_len -= skb->len;
- break;
- case ISO_END:
- if (!conn->rx_len) {
- BT_ERR("Unexpected end frame (len %d)", skb->len);
- goto drop;
- }
-
- skb_copy_from_linear_data(skb, skb_put(conn->rx_skb, skb->len),
- skb->len);
- conn->rx_len -= skb->len;
+ if (pb == ISO_CONT)
+ break;
if (!conn->rx_len) {
struct sk_buff *rx_skb = conn->rx_skb;
@@ -2663,6 +2657,13 @@ int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags)
*/
conn->rx_skb = NULL;
iso_recv_frame(conn, rx_skb);
+ } else {
+ BT_ERR("ISO fragment incomplete (len %d, expected %d)",
+ skb->len, conn->rx_len);
+ kfree_skb(conn->rx_skb);
+ conn->rx_skb = NULL;
+ conn->rx_len = 0;
+ goto drop;
}
break;
}
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] Bluetooth: ISO: exclude RFU bits from ISO_SDU_Length
2026-07-01 15:46 [PATCH 1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling Pauli Virtanen
@ 2026-07-01 15:46 ` Pauli Virtanen
2026-07-01 17:00 ` [1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling bluez.test.bot
2026-07-02 16:10 ` [PATCH 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Pauli Virtanen @ 2026-07-01 15:46 UTC (permalink / raw)
To: linux-bluetooth
Cc: Pauli Virtanen, marcel, luiz.dentz, devnexen, linux-kernel
slen contains ISO_SDU_Length (12 bits), RFU (2 bits),
Packet_Status_Flags (2 bits).
Exclude the RFU bits from hci_iso_data_len. Also add masks to the pack
macro.
Fixes: 4de0fc599eb9 ("Bluetooth: Add definitions for CIS connections")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
---
include/net/bluetooth/hci.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 38186a245f14..50f0eef71fb1 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -3413,8 +3413,9 @@ static inline struct hci_iso_hdr *hci_iso_hdr(const struct sk_buff *skb)
#define hci_iso_flags_pack(pb, ts) ((pb & 0x03) | ((ts & 0x01) << 2))
/* ISO data length and flags pack/unpack */
-#define hci_iso_data_len_pack(h, f) ((__u16) ((h) | ((f) << 14)))
-#define hci_iso_data_len(h) ((h) & 0x3fff)
+#define hci_iso_data_len_pack(h, f) ((__u16) (((h) & 0x0fff) | \
+ (((f) & 0x3) << 14)))
+#define hci_iso_data_len(h) ((h) & 0x0fff)
#define hci_iso_data_flags(h) ((h) >> 14)
/* codec transport types */
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* RE: [1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling
2026-07-01 15:46 [PATCH 1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling Pauli Virtanen
2026-07-01 15:46 ` [PATCH 2/2] Bluetooth: ISO: exclude RFU bits from ISO_SDU_Length Pauli Virtanen
@ 2026-07-01 17:00 ` bluez.test.bot
2026-07-02 16:10 ` [PATCH 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-07-01 17:00 UTC (permalink / raw)
To: linux-bluetooth, pav
[-- Attachment #1: Type: text/plain, Size: 2389 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=1119954
---Test result---
Test Summary:
CheckPatch PASS 1.16 seconds
VerifyFixes PASS 0.08 seconds
VerifySignedoff PASS 0.09 seconds
GitLint PASS 0.48 seconds
SubjectPrefix PASS 0.15 seconds
BuildKernel PASS 25.74 seconds
CheckAllWarning PASS 32.87 seconds
CheckSparse PASS 26.59 seconds
BuildKernel32 PASS 24.57 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 456.24 seconds
TestRunner_l2cap-tester PASS 57.27 seconds
TestRunner_iso-tester PASS 81.36 seconds
TestRunner_bnep-tester PASS 18.68 seconds
TestRunner_mgmt-tester FAIL 207.92 seconds
TestRunner_rfcomm-tester PASS 25.09 seconds
TestRunner_sco-tester PASS 31.73 seconds
TestRunner_ioctl-tester PASS 25.50 seconds
TestRunner_mesh-tester FAIL 25.88 seconds
TestRunner_smp-tester PASS 22.55 seconds
TestRunner_userchan-tester PASS 19.51 seconds
TestRunner_6lowpan-tester PASS 22.29 seconds
IncrementalBuild PASS 40.58 seconds
Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.243 seconds
##############################
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.605 seconds
Mesh - Send cancel - 2 Timed out 1.988 seconds
https://github.com/bluez/bluetooth-next/pull/381
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling
2026-07-01 15:46 [PATCH 1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling Pauli Virtanen
2026-07-01 15:46 ` [PATCH 2/2] Bluetooth: ISO: exclude RFU bits from ISO_SDU_Length Pauli Virtanen
2026-07-01 17:00 ` [1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling bluez.test.bot
@ 2026-07-02 16:10 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2026-07-02 16:10 UTC (permalink / raw)
To: Pauli Virtanen
Cc: linux-bluetooth, marcel, luiz.dentz, devnexen, linux-kernel
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 1 Jul 2026 18:46:38 +0300 you wrote:
> Core specification (Part C vol 4 sec 5.4.5) does not exclude empty
> ISO_CONT, ISO_END packets. We currently reject them if they are last.
>
> If controller sends malformed sequence
>
> ISO_START -> rx_len = 4, ISO_CONT skb->len 4, ISO_START
>
> [...]
Here is the summary with links:
- [1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling
https://git.kernel.org/bluetooth/bluetooth-next/c/103ac7b87e1f
- [2/2] Bluetooth: ISO: exclude RFU bits from ISO_SDU_Length
https://git.kernel.org/bluetooth/bluetooth-next/c/9496dfbab73f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-02 16:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 15:46 [PATCH 1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling Pauli Virtanen
2026-07-01 15:46 ` [PATCH 2/2] Bluetooth: ISO: exclude RFU bits from ISO_SDU_Length Pauli Virtanen
2026-07-01 17:00 ` [1/2] Bluetooth: ISO: fix malformed ISO_END/CONT handling bluez.test.bot
2026-07-02 16:10 ` [PATCH 1/2] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox