* [PATCH] Bluetooth: ISO: fix NULL deref in iso_recv() ISO_END handling
@ 2026-03-28 3:58 Nathan Rebello
2026-03-28 4:22 ` bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Rebello @ 2026-03-28 3:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: luiz.dentz, marcel, stable, kyungtae.kim, Nathan Rebello
The ISO_CONT case in iso_recv() properly checks for unexpected
continuation frames (!conn->rx_len) and oversized fragments
(skb->len > conn->rx_len) before accessing conn->rx_skb. The
ISO_END case lacks both checks.
When an ISO_END packet arrives without a preceding ISO_START:
- conn->rx_skb is NULL (never allocated)
- skb_put(conn->rx_skb, ...) dereferences NULL -> kernel crash
When an ISO_END fragment is larger than the remaining expected
length:
- skb_put() extends past conn->rx_skb->end
- triggers skb_over_panic -> kernel BUG
KASAN confirmed the NULL-deref on kernel 7.0.0-rc5 via VHCI:
general protection fault, probably for non-canonical address 0xdffffc0000000018
KASAN: null-ptr-deref in range [0x00000000000000c0-0x00000000000000c7]
CPU: 0 UID: 0 PID: 72 Comm: kworker/u9:0 Not tainted 7.0.0-rc5
Workqueue: hci0 hci_rx_work
RIP: 0010:skb_put+0x27/0x1a0
Call Trace:
<TASK>
iso_recv+0x5e0/0xee0
hci_rx_work+0x226/0x730
process_one_work+0x633/0x1060
worker_thread+0x45b/0xd10
kthread+0x2c6/0x3b0
ret_from_fork+0x38d/0x5c0
</TASK>
Kernel panic - not syncing: Fatal exception
Fix by adding the same validation that ISO_CONT already has:
reject unexpected end frames and oversized fragments.
Fixes: ccf74f2390d6 ("Bluetooth: Add ISO Socket")
Cc: stable@vger.kernel.org
Signed-off-by: Nathan Rebello <nathan.c.rebello@gmail.com>
---
net/bluetooth/iso.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index be145e273..97b5fc9da 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -2587,6 +2587,20 @@ int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags)
break;
case ISO_END:
+ if (!conn->rx_len) {
+ BT_ERR("Unexpected end frame (len %d)", skb->len);
+ goto drop;
+ }
+
+ if (skb->len > conn->rx_len) {
+ BT_ERR("End fragment is too long (len %d, expected %d)",
+ skb->len, conn->rx_len);
+ kfree_skb(conn->rx_skb);
+ conn->rx_skb = NULL;
+ conn->rx_len = 0;
+ goto drop;
+ }
+
skb_copy_from_linear_data(skb, skb_put(conn->rx_skb, skb->len),
skb->len);
conn->rx_len -= skb->len;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: Bluetooth: ISO: fix NULL deref in iso_recv() ISO_END handling
2026-03-28 3:58 [PATCH] Bluetooth: ISO: fix NULL deref in iso_recv() ISO_END handling Nathan Rebello
@ 2026-03-28 4:22 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-03-28 4:22 UTC (permalink / raw)
To: linux-bluetooth, nathan.c.rebello
[-- Attachment #1: Type: text/plain, Size: 2913 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=1073872
---Test result---
Test Summary:
CheckPatch PENDING 0.51 seconds
GitLint PENDING 0.25 seconds
SubjectPrefix PASS 0.07 seconds
BuildKernel PASS 24.40 seconds
CheckAllWarning PASS 27.36 seconds
CheckSparse PASS 25.86 seconds
BuildKernel32 PASS 24.35 seconds
TestRunnerSetup PASS 533.15 seconds
TestRunner_l2cap-tester PASS 28.29 seconds
TestRunner_iso-tester PASS 40.09 seconds
TestRunner_bnep-tester PASS 6.46 seconds
TestRunner_mgmt-tester FAIL 114.08 seconds
TestRunner_rfcomm-tester PASS 9.50 seconds
TestRunner_sco-tester FAIL 14.40 seconds
TestRunner_ioctl-tester PASS 10.28 seconds
TestRunner_mesh-tester FAIL 12.38 seconds
TestRunner_smp-tester PASS 8.73 seconds
TestRunner_userchan-tester PASS 6.79 seconds
IncrementalBuild PENDING 0.93 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 485 (98.2%), Failed: 5, Not Run: 4
Failed Test Cases
Adv. connectable & connected (central) - Success Failed 0.130 seconds
Adv. non-connectable & connected (central) - Success Failed 0.124 seconds
Ext Adv. connectable & connected (central) Failed 0.176 seconds
Ext Adv. non-connectable & connected (central) Failed 0.182 seconds
Read Exp Feature - Success Failed 0.108 seconds
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
BUG: sleeping function called from invalid context at net/core/sock.c:3782
Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0
##############################
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.646 seconds
Mesh - Send cancel - 2 Timed out 1.995 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-28 4:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-28 3:58 [PATCH] Bluetooth: ISO: fix NULL deref in iso_recv() ISO_END handling Nathan Rebello
2026-03-28 4:22 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox