linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] monitor: show ISO timestamps and fix their handling
@ 2025-12-06 14:11 Pauli Virtanen
  2025-12-06 15:18 ` [BlueZ] " bluez.test.bot
  2025-12-09 15:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Pauli Virtanen @ 2025-12-06 14:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Fix ISO packet size checks, taking timestamp presence into account.

Also display timestamp value if present.
---
 monitor/packet.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index 2ae4f8fff..4f90c412d 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -14205,8 +14205,9 @@ void packet_hci_isodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 	const struct bt_hci_iso_data_start *start;
 	uint16_t handle = le16_to_cpu(hdr->handle);
 	uint8_t flags = acl_flags(handle);
-	char handle_str[36], extra_str[33];
+	char handle_str[36], extra_str[50], ts_str[16] = { 0 };
 	struct index_buf_pool *pool = &index_list[index].iso;
+	size_t ts_size = 0;
 
 	if (index >= MAX_INDEX) {
 		print_field("Invalid index (%d).", index);
@@ -14223,11 +14224,15 @@ void packet_hci_isodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 
 	/* Detect if timestamp field is preset */
 	if (iso_flags_ts(flags)) {
-		if (size < sizeof(uint32_t))
+		ts_size = sizeof(uint32_t);
+
+		if (size < ts_size)
 			goto malformed;
 
-		data += sizeof(uint32_t);
-		size -= sizeof(uint32_t);
+		snprintf(ts_str, sizeof(ts_str), " ts %u", get_le32(data));
+
+		data += ts_size;
+		size -= ts_size;
 	}
 
 	start = data;
@@ -14239,8 +14244,8 @@ void packet_hci_isodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 		sprintf(handle_str, "Handle %u SN %u", acl_handle(handle),
 			start->sn);
 
-	sprintf(extra_str, "flags 0x%2.2x dlen %u slen %u", flags, hdr->dlen,
-		start->slen);
+	sprintf(extra_str, "flags 0x%2.2x dlen %u slen %u%s", flags, hdr->dlen,
+							start->slen, ts_str);
 
 	print_packet(tv, cred, in ? '>' : '<', index, NULL, COLOR_HCI_ISODATA,
 				in ? "ISO Data RX" : "ISO Data TX",
@@ -14250,9 +14255,16 @@ void packet_hci_isodata(struct timeval *tv, struct ucred *cred, uint16_t index,
 		packet_enqueue_tx(tv, acl_handle(handle),
 					index_list[index].frame, hdr->dlen);
 
-	if (size != hdr->dlen) {
+	if (size + ts_size != hdr->dlen) {
 		print_text(COLOR_ERROR, "invalid packet size (%d != %d)",
-							size, hdr->dlen);
+						size + (int)ts_size, hdr->dlen);
+		packet_hexdump(data, size);
+		return;
+	}
+
+	if (size != start->slen + 4) {
+		print_text(COLOR_ERROR, "invalid packet slen (%d+4 != %d)",
+							start->slen, size);
 		packet_hexdump(data, size);
 		return;
 	}
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ] monitor: show ISO timestamps and fix their handling
  2025-12-06 14:11 [PATCH BlueZ] monitor: show ISO timestamps and fix their handling Pauli Virtanen
@ 2025-12-06 15:18 ` bluez.test.bot
  2025-12-09 15:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-12-06 15:18 UTC (permalink / raw)
  To: linux-bluetooth, pav

[-- Attachment #1: Type: text/plain, Size: 1634 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=1031084

---Test result---

Test Summary:
CheckPatch                    PENDING   0.24 seconds
GitLint                       PENDING   0.31 seconds
BuildEll                      PASS      19.95 seconds
BluezMake                     PASS      630.17 seconds
MakeCheck                     PASS      22.33 seconds
MakeDistcheck                 PASS      242.10 seconds
CheckValgrind                 PASS      300.44 seconds
CheckSmatch                   WARNING   350.13 seconds
bluezmakeextell               PASS      183.23 seconds
IncrementalBuild              PENDING   0.22 seconds
ScanBuild                     PASS      1019.59 seconds

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

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

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1931:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3866:52: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] monitor: show ISO timestamps and fix their handling
  2025-12-06 14:11 [PATCH BlueZ] monitor: show ISO timestamps and fix their handling Pauli Virtanen
  2025-12-06 15:18 ` [BlueZ] " bluez.test.bot
@ 2025-12-09 15:40 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-12-09 15:40 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Sat,  6 Dec 2025 16:11:52 +0200 you wrote:
> Fix ISO packet size checks, taking timestamp presence into account.
> 
> Also display timestamp value if present.
> ---
>  monitor/packet.c | 28 ++++++++++++++++++++--------
>  1 file changed, 20 insertions(+), 8 deletions(-)

Here is the summary with links:
  - [BlueZ] monitor: show ISO timestamps and fix their handling
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=359390c60d9b

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] 3+ messages in thread

end of thread, other threads:[~2025-12-09 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-06 14:11 [PATCH BlueZ] monitor: show ISO timestamps and fix their handling Pauli Virtanen
2025-12-06 15:18 ` [BlueZ] " bluez.test.bot
2025-12-09 15:40 ` [PATCH BlueZ] " 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;
as well as URLs for NNTP newsgroup(s).