Skip to contentSkip to conversation

iso-tester: Fix crashing while attemping to access isodata

PATCH Applied Luiz Augusto von Dentz 3 participants 3 messages Jun 16, 2025 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 iso-tester: Fix crashing while attemping to access isodata

From: Luiz Augusto von Dentz <[email protected]>

Some tests may not set any isodata causing the following crash:

Invalid read of size 1
at 0x40067A8: setup_powered_callback (iso-tester.c:1691) by 0x40232D5: request_complete (mgmt.c:306)
by 0x40242B3: can_read_data (mgmt.c:394)
by 0x4028529: watch_callback (io-glib.c:173)
by 0x493D87F: ??? (in /usr/lib64/libglib-2.0.so.0.8400.2) by 0x49467A7: ??? (in /usr/lib64/libglib-2.0.so.0.8400.2) by 0x4946A4E: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.8400.2) by 0x402ABFD: mainloop_run (mainloop-glib.c:65)
by 0x402B1D4: mainloop_run_with_signal (mainloop-notify.c:196) by 0x402A3F5: tester_run (tester.c:1076)
by 0x40050FE: main (iso-tester.c:4010)
Address 0xa8 is not stack'd, malloc'd or (recently) free'd

---
 tools/iso-tester.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
tools/iso-tester.c +7 -3
index 725fd3338c9f..56550882ea63 100644
@@ -1683,13 +1683,17 @@ static void setup_powered_callback(uint8_t status, uint16_t length,
 	for (i = 0; i < data->client_num; i++) {
 		struct hciemu_client *client;
 		struct bthost *host;
+		uint8_t sid = 0;
 
 		client = hciemu_get_client(data->hciemu, i);
 		host = hciemu_client_host(client);
 		bthost_set_cmd_complete_cb(host, client_connectable_complete,
 									data);
-		bthost_set_ext_adv_params(host, isodata->sid != 0xff ?
-						isodata->sid : 0x00);
+
+		if (isodata)
+			sid = isodata->sid;
+
+		bthost_set_ext_adv_params(host, sid != 0xff ? sid : 0x00);
 		bthost_set_ext_adv_enable(host, 0x01);
 
 		if (!isodata)
@@ -1903,7 +1907,7 @@ static int create_iso_sock(struct test_data *data)
 		addr->iso_family = AF_BLUETOOTH;
 		bacpy(&addr->iso_bdaddr, (void *) master_bdaddr);
 		addr->iso_bdaddr_type = BDADDR_LE_PUBLIC;
-		err = bind(sk, (struct sockaddr *) addr, sizeof(addr));
+		err = bind(sk, (struct sockaddr *) addr, sizeof(*addr));
 	}
 
 	if (err < 0) {
Signature · 1 line
2.49.0
#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=972634

---Test result---

Test Summary:

CheckPatch                    PENDING   0.19 seconds
GitLint                       PENDING   0.23 seconds
BuildEll                      PASS      20.42 seconds
BluezMake                     PASS      2687.36 seconds
MakeCheck                     PASS      20.25 seconds
MakeDistcheck                 PASS      199.47 seconds
CheckValgrind                 PASS      274.74 seconds
CheckSmatch                   PASS      305.47 seconds
bluezmakeextell               PASS      128.43 seconds
IncrementalBuild              PENDING   0.23 seconds
ScanBuild                     PASS      913.67 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

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

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Luiz Augusto von Dentz
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 18 lines · On Mon, 16 Jun 2025 13:55:11 -0400 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

Some tests may not set any isodata causing the following crash:

Invalid read of size 1
at 0x40067A8: setup_powered_callback (iso-tester.c:1691) by 0x40232D5: request_complete (mgmt.c:306)
by 0x40242B3: can_read_data (mgmt.c:394)
by 0x4028529: watch_callback (io-glib.c:173)
by 0x493D87F: ??? (in /usr/lib64/libglib-2.0.so.0.8400.2) by 0x49467A7: ??? (in /usr/lib64/libglib-2.0.so.0.8400.2) by 0x4946A4E: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.8400.2) by 0x402ABFD: mainloop_run (mainloop-glib.c:65)
by 0x402B1D4: mainloop_run_with_signal (mainloop-notify.c:196) by 0x402A3F5: tester_run (tester.c:1076)
by 0x40050FE: main (iso-tester.c:4010)
Address 0xa8 is not stack'd, malloc'd or (recently) free'd

Quoted 1 line

[...]

Here is the summary with links:
- [BlueZ,v1] iso-tester: Fix crashing while attemping to access isodata

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3c20aa6c2ff1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html