Skip to contentSkip to conversation

Bluetooth: iso: Fix UAF on iso_sock_disconn

PATCH Superseded Yang Li 4 participants 5 messages Nov 5, 2025 – Nov 7, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 Bluetooth: iso: Fix UAF on iso_sock_disconn

kernel panic: Unable to handle kernel read from unreadable memory at virtual address 00000000000003d8

Call trace:
 iso_sock_disconn+0x110/0x1c8
 __iso_sock_close+0x50/0x164
 iso_sock_release+0x48/0xf0
 __sock_release+0x40/0xb4
 sock_close+0x18/0x28
 __fput+0xd8/0x28c
 __fput_sync+0x50/0x5c
 __arm64_sys_close+0x38/0x7c
 invoke_syscall+0x48/0x118
 el0_svc_common.constprop.0+0x40/0xe0
 do_el0_svc_compat+0x1c/0x34
 el0_svc_compat+0x30/0x88
 el0t_32_sync_handler+0x90/0x140
 el0t_32_sync+0x198/0x19c
---
 net/bluetooth/iso.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/iso.c +2 -2
index 74ec7d125c88..89c7700ceb81 100644
@@ -838,14 +838,14 @@ static void __iso_sock_close(struct sock *sk)
 	case BT_CONNECT:
 	case BT_CONNECTED:
 	case BT_CONFIG:
-		if (iso_pi(sk)->conn->hcon)
+		if (iso_pi(sk)->conn && iso_pi(sk)->conn->hcon)
 			iso_sock_disconn(sk);
 		else
 			iso_chan_del(sk, ECONNRESET);
 		break;
 
 	case BT_CONNECT2:
-		if (iso_pi(sk)->conn->hcon &&
+		if (iso_pi(sk)->conn && iso_pi(sk)->conn->hcon &&
 		    (test_bit(HCI_CONN_PA_SYNC, &iso_pi(sk)->conn->hcon->flags) ||
 		    test_bit(HCI_CONN_PA_SYNC_FAILED, &iso_pi(sk)->conn->hcon->flags)))
 			iso_sock_disconn(sk);

---
base-commit: 2747d929617743ecba08eeeb310283b4be681383
change-id: 20251105-kernel_panic-73adc703480d

Best regards,

Signature · 1 line
Yang Li <[email protected]>
#1 lore raw

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=1019783

---Test result---

Test Summary:

CheckPatch                    PENDING   0.29 seconds
GitLint                       PENDING   0.25 seconds
SubjectPrefix                 PASS      0.11 seconds
BuildKernel                   PASS      25.47 seconds
CheckAllWarning               PASS      27.35 seconds
CheckSparse                   PASS      30.92 seconds
BuildKernel32                 PASS      24.80 seconds
TestRunnerSetup               PASS      496.53 seconds
TestRunner_l2cap-tester       PASS      23.75 seconds
TestRunner_iso-tester         PASS      78.33 seconds
TestRunner_bnep-tester        PASS      6.13 seconds
TestRunner_mgmt-tester        FAIL      120.19 seconds
TestRunner_rfcomm-tester      PASS      9.03 seconds
TestRunner_sco-tester         PASS      14.23 seconds
TestRunner_ioctl-tester       PASS      9.81 seconds
TestRunner_mesh-tester        FAIL      11.50 seconds
TestRunner_smp-tester         PASS      8.34 seconds
TestRunner_userchan-tester    PASS      6.43 seconds
IncrementalBuild              PENDING   1.05 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: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
Read Exp Feature - Success Failed 0.100 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.135 seconds
Mesh - Send cancel - 2                               Timed out    1.998 seconds

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Yang Li

Dear Yang,

Thank you for your patch.

Am 05.11.25 um 10:02 schrieb Yang Li via B4 Relay:

Quoted 4 lines

From: Yang Li <[email protected]>

kernel panic: Unable to handle kernel read from unreadable memory at virtual address 00000000000003d8

No line break needed in pasted logs.

Quoted 16 lines
Call trace:
  iso_sock_disconn+0x110/0x1c8
  __iso_sock_close+0x50/0x164
  iso_sock_release+0x48/0xf0
  __sock_release+0x40/0xb4
  sock_close+0x18/0x28
  __fput+0xd8/0x28c
  __fput_sync+0x50/0x5c
  __arm64_sys_close+0x38/0x7c
  invoke_syscall+0x48/0x118
  el0_svc_common.constprop.0+0x40/0xe0
  do_el0_svc_compat+0x1c/0x34
  el0_svc_compat+0x30/0x88
  el0t_32_sync_handler+0x90/0x140
  el0t_32_sync+0x198/0x19c

Please add a paragraph about this problem, and how iso_pi(sk)->conn can be NULL.

Quoted 16 lines
---
  net/bluetooth/iso.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/iso.c +1 -1
index 74ec7d125c88..89c7700ceb81 100644
@@ -838,14 +838,14 @@ static void __iso_sock_close(struct sock *sk)
  	case BT_CONNECT:
  	case BT_CONNECTED:
  	case BT_CONFIG:
-		if (iso_pi(sk)->conn->hcon)
+		if (iso_pi(sk)->conn && iso_pi(sk)->conn->hcon)
  			iso_sock_disconn(sk);

net/bluetooth/iso.c static void __iso_sock_close(struct sock *sk) · line 851

Quoted 10 lines
net/bluetooth/iso.c +1 -1
  		else
  			iso_chan_del(sk, ECONNRESET);
  		break;
 
  	case BT_CONNECT2:
-		if (iso_pi(sk)->conn->hcon &&
+		if (iso_pi(sk)->conn && iso_pi(sk)->conn->hcon &&
  		    (test_bit(HCI_CONN_PA_SYNC, &iso_pi(sk)->conn->hcon->flags) ||
  		    test_bit(HCI_CONN_PA_SYNC_FAILED, &iso_pi(sk)->conn->hcon->flags)))
  			iso_sock_disconn(sk);

This diff looks fine.

Kind regards,

Paul

author
#3 lore raw

Hi Paul,

Quoted 32 lines

[ EXTERNAL EMAIL ]

Dear Yang,

Thank you for your patch.

Am 05.11.25 um 10:02 schrieb Yang Li via B4 Relay:

Quoted 4 lines

From: Yang Li <[email protected]>

kernel panic: Unable to handle kernel read from unreadable memory at virtual address 00000000000003d8

No line break needed in pasted logs.

Quoted 16 lines
Call trace:
  iso_sock_disconn+0x110/0x1c8
  __iso_sock_close+0x50/0x164
  iso_sock_release+0x48/0xf0
  __sock_release+0x40/0xb4
  sock_close+0x18/0x28
  __fput+0xd8/0x28c
  __fput_sync+0x50/0x5c
  __arm64_sys_close+0x38/0x7c
  invoke_syscall+0x48/0x118
  el0_svc_common.constprop.0+0x40/0xe0
  do_el0_svc_compat+0x1c/0x34
  el0_svc_compat+0x30/0x88
  el0t_32_sync_handler+0x90/0x140
  el0t_32_sync+0x198/0x19c
Quoted 2 lines

Please add a paragraph about this problem, and how iso_pi(sk)->conn can be NULL.

I will update it.

Thanks!

Quoted 34 lines
Quoted 21 lines

---
  net/bluetooth/iso.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/iso.c +0 -0
index 74ec7d125c88..89c7700ceb81 100644
@@ -838,14 +838,14 @@ static void __iso_sock_close(struct sock *sk)

      case BT_CONNECT:
      case BT_CONNECTED:
      case BT_CONFIG:
-             if (iso_pi(sk)->conn->hcon)
+             if (iso_pi(sk)->conn && iso_pi(sk)->conn->hcon) iso_sock_disconn(sk);
              else
                      iso_chan_del(sk, ECONNRESET); break;

Quoted 6 lines

      case BT_CONNECT2:
-             if (iso_pi(sk)->conn->hcon &&
+             if (iso_pi(sk)->conn && iso_pi(sk)->conn->hcon && (test_bit(HCI_CONN_PA_SYNC, &iso_pi(sk)->conn->hcon->flags) || test_bit(HCI_CONN_PA_SYNC_FAILED, &iso_pi(sk)->conn->hcon->flags))) iso_sock_disconn(sk);

This diff looks fine.

Kind regards,

Paul

#4 lore raw

Hi Yang,

Quoted 65 lines · Yang Li

Hi Paul,

Quoted 32 lines

[ EXTERNAL EMAIL ]

Dear Yang,

Thank you for your patch.

Am 05.11.25 um 10:02 schrieb Yang Li via B4 Relay:

Quoted 4 lines

From: Yang Li <[email protected]>

kernel panic: Unable to handle kernel read from unreadable memory at virtual address 00000000000003d8

No line break needed in pasted logs.

Quoted 16 lines
Call trace:
  iso_sock_disconn+0x110/0x1c8
  __iso_sock_close+0x50/0x164
  iso_sock_release+0x48/0xf0
  __sock_release+0x40/0xb4
  sock_close+0x18/0x28
  __fput+0xd8/0x28c
  __fput_sync+0x50/0x5c
  __arm64_sys_close+0x38/0x7c
  invoke_syscall+0x48/0x118
  el0_svc_common.constprop.0+0x40/0xe0
  do_el0_svc_compat+0x1c/0x34
  el0_svc_compat+0x30/0x88
  el0t_32_sync_handler+0x90/0x140
  el0t_32_sync+0x198/0x19c
Quoted 2 lines

Please add a paragraph about this problem, and how iso_pi(sk)->conn can be NULL.

I will update it.

Thanks!

Quoted 21 lines
Quoted 21 lines
---
  net/bluetooth/iso.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/iso.c +1 -1
index 74ec7d125c88..89c7700ceb81 100644
@@ -838,14 +838,14 @@ static void __iso_sock_close(struct sock *sk)
      case BT_CONNECT:
      case BT_CONNECTED:
      case BT_CONFIG:
-             if (iso_pi(sk)->conn->hcon)
+             if (iso_pi(sk)->conn && iso_pi(sk)->conn->hcon)
                      iso_sock_disconn(sk);
              else
                      iso_chan_del(sk, ECONNRESET);
              break;
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
net/bluetooth/iso.c +1 -1
      case BT_CONNECT2:
-             if (iso_pi(sk)->conn->hcon &&
+             if (iso_pi(sk)->conn && iso_pi(sk)->conn->hcon &&
                  (test_bit(HCI_CONN_PA_SYNC,

&iso_pi(sk)->conn->hcon->flags) ||
test_bit(HCI_CONN_PA_SYNC_FAILED,
&iso_pi(sk)->conn->hcon->flags)))

                      iso_sock_disconn(sk);

Hold on since the bug is actually in the handling of BIG Sync Lost, it has been assuming that it also means PA Sync is lost as well when that is inform byt its own event PA Sync Lost:

https://patchwork.kernel.org/project/bluetooth/patch/[email protected]/

Also note that Ive changed the handling so it no longer calls hci_conn_del without first calling hci_disconn_cfm, since the latter actually informs the socket layers about the imminent deletion so the socket can go ahead and clean up properly.

Quoted 6 lines
Quoted 6 lines

This diff looks fine.

Kind regards,

Paul

Signature · 1 line
Luiz Augusto von Dentz