2020-04-09 11:29:25

by daniels

[permalink] [raw]
Subject: [PATCH] Bluetooth: log advertisement packet length if it gets corrected

From: Daniels Umanovskis <[email protected]>

The error could indicate a problem with the Bluetooth device. It
is easier to investigate if the packet's actual length gets logged,
not just the fact that a discrepancy occurred.

Signed-off-by: Daniels Umanovskis <[email protected]>
---
net/bluetooth/hci_event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 0a591be8b0ae..af7fa7ef94ed 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -5353,7 +5353,8 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,

/* Adjust for actual length */
if (len != real_len) {
- bt_dev_err_ratelimited(hdev, "advertising data len corrected");
+ bt_dev_err_ratelimited(hdev, "advertising data len corrected %u -> %u",
+ len, real_len);
len = real_len;
}

--
2.20.1


2020-04-09 15:12:35

by Alain Michaud

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: log advertisement packet length if it gets corrected

On Thu, Apr 9, 2020 at 7:28 AM <[email protected]> wrote:
>
> From: Daniels Umanovskis <[email protected]>
>
> The error could indicate a problem with the Bluetooth device. It
> is easier to investigate if the packet's actual length gets logged,
> not just the fact that a discrepancy occurred.
>
> Signed-off-by: Daniels Umanovskis <[email protected]>
> ---
> net/bluetooth/hci_event.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 0a591be8b0ae..af7fa7ef94ed 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -5353,7 +5353,8 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
>
> /* Adjust for actual length */
> if (len != real_len) {
> - bt_dev_err_ratelimited(hdev, "advertising data len corrected");
> + bt_dev_err_ratelimited(hdev, "advertising data len corrected %u -> %u",
> + len, real_len);
> len = real_len;
> }
>
> --
> 2.20.1
>

Reviewed-by: Alain Michaud <[email protected]>

2020-04-09 18:00:01

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: log advertisement packet length if it gets corrected

Hi Daniels,

> The error could indicate a problem with the Bluetooth device. It
> is easier to investigate if the packet's actual length gets logged,
> not just the fact that a discrepancy occurred.
>
> Signed-off-by: Daniels Umanovskis <[email protected]>
> ---
> net/bluetooth/hci_event.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel