diff mbox series

[BlueZ] btmon: Fix decoding truncated data

Message ID 20230306145217.7662-1-lukasz.rymanowski@codecoup.pl (mailing list archive)
State Accepted
Commit 6ae44c74aaf93468ddc626a02b8f0420a808b13e
Headers show
Series [BlueZ] btmon: Fix decoding truncated data | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning WARNING:TYPO_SPELLING: 'lenght' may be misspelled - perhaps 'length'? #82: In such a case, included lenght is smaller the original size. ^^^^^^ /github/workspace/src/src/13161351.patch total: 0 errors, 1 warnings, 32 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13161351.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Łukasz Rymanowski March 6, 2023, 2:52 p.m. UTC
Some platforms use different filtering and for this purpose,
some of the ACL/SCO/ISO/SDP data are truncated.

In such a case, included lenght is smaller the original size.
Without this fix, btmon stops working after first truncated packet.
---
 src/shared/btsnoop.c | 2 +-
 tools/btsnoop.c      | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Paul Menzel March 6, 2023, 3:13 p.m. UTC | #1
Dear Łukasz,


Thank you for your patch.

Am 06.03.23 um 15:52 schrieb Łukasz Rymanowski:
> Some platforms use different filtering and for this purpose,
> some of the ACL/SCO/ISO/SDP data are truncated.

(… is truncated.)

It’d be great if you listed an example to reproduce it.

> In such a case, included lenght is smaller the original size.

•   leng*th*
•   … smaller than the original size.

> Without this fix, btmon stops working after first truncated packet.
> ---
>   src/shared/btsnoop.c | 2 +-
>   tools/btsnoop.c      | 6 +++---
>   2 files changed, 4 insertions(+), 4 deletions(-)

[…]


Kind regards,

Paul
bluez.test.bot@gmail.com March 6, 2023, 4:09 p.m. UTC | #2
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=726931

---Test result---

Test Summary:
CheckPatch                    FAIL      0.71 seconds
GitLint                       PASS      0.29 seconds
BuildEll                      PASS      26.59 seconds
BluezMake                     PASS      757.14 seconds
MakeCheck                     PASS      11.34 seconds
MakeDistcheck                 PASS      148.52 seconds
CheckValgrind                 PASS      239.58 seconds
CheckSmatch                   PASS      319.68 seconds
bluezmakeextell               PASS      96.15 seconds
IncrementalBuild              PASS      607.68 seconds
ScanBuild                     PASS      959.22 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ] btmon: Fix decoding truncated data
WARNING:TYPO_SPELLING: 'lenght' may be misspelled - perhaps 'length'?
#82: 
In such a case, included lenght is smaller the original size.
                         ^^^^^^

/github/workspace/src/src/13161351.patch total: 0 errors, 1 warnings, 32 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13161351.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org March 14, 2023, 7:50 p.m. UTC | #3
Hello:

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

On Mon,  6 Mar 2023 15:52:17 +0100 you wrote:
> Some platforms use different filtering and for this purpose,
> some of the ACL/SCO/ISO/SDP data are truncated.
> 
> In such a case, included lenght is smaller the original size.
> Without this fix, btmon stops working after first truncated packet.
> ---
>  src/shared/btsnoop.c | 2 +-
>  tools/btsnoop.c      | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)

Here is the summary with links:
  - [BlueZ] btmon: Fix decoding truncated data
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6ae44c74aaf9

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/shared/btsnoop.c b/src/shared/btsnoop.c
index 0a68282bc..8b93203b3 100644
--- a/src/shared/btsnoop.c
+++ b/src/shared/btsnoop.c
@@ -513,7 +513,7 @@  bool btsnoop_read_hci(struct btsnoop *btsnoop, struct timeval *tv,
 		return false;
 	}
 
-	toread = be32toh(pkt.size);
+	toread = be32toh(pkt.len);
 	if (toread > BTSNOOP_MAX_PACKET_SIZE) {
 		btsnoop->aborted = true;
 		return false;
diff --git a/tools/btsnoop.c b/tools/btsnoop.c
index a0d6cf356..efaa45db4 100644
--- a/tools/btsnoop.c
+++ b/tools/btsnoop.c
@@ -283,7 +283,7 @@  next_packet:
 	if (len < 0 || len != BTSNOOP_PKT_SIZE)
 		goto close_input;
 
-	toread = be32toh(pkt.size);
+	toread = be32toh(pkt.len);
 	flags = be32toh(pkt.flags);
 
 	opcode = flags & 0x00ff;
@@ -356,7 +356,7 @@  next_packet:
 	if (len < 0 || len != BTSNOOP_PKT_SIZE)
 		goto close_input;
 
-	toread = be32toh(pkt.size);
+	toread = be32toh(pkt.len);
 	flags = be32toh(pkt.flags);
 
 	opcode = flags & 0x00ff;
@@ -433,7 +433,7 @@  next_packet:
 	if (len < 0 || len != BTSNOOP_PKT_SIZE)
 		goto close_input;
 
-	toread = be32toh(pkt.size);
+	toread = be32toh(pkt.len);
 
 	len = read(fd, buf, toread);
 	if (len < 0 || len != (ssize_t) toread) {