* [PATCH] Bluetooth: Prevent unintended pause by checking if advertising is active
@ 2025-06-16 11:05 ` Yang Li via B4 Relay
0 siblings, 0 replies; 5+ messages in thread
From: Yang Li @ 2025-06-16 11:05 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
Cc: linux-bluetooth, linux-kernel, Yang Li
When PA Create Sync is enabled, advertising resumes unexpectedly.
Therefore, it's necessary to check whether advertising is currently
active before attempting to pause it.
< HCI Command: LE Add Device To... (0x08|0x0011) plen 7 #1345 [hci0] 48.306205
Address type: Random (0x01)
Address: 4F:84:84:5F:88:17 (Resolvable)
Identity type: Random (0x01)
Identity: FC:5B:8C:F7:5D:FB (Static)
< HCI Command: LE Set Address Re.. (0x08|0x002d) plen 1 #1347 [hci0] 48.308023
Address resolution: Enabled (0x01)
...
< HCI Command: LE Set Extended A.. (0x08|0x0039) plen 6 #1349 [hci0] 48.309650
Extended advertising: Enabled (0x01)
Number of sets: 1 (0x01)
Entry 0
Handle: 0x01
Duration: 0 ms (0x00)
Max ext adv events: 0
...
< HCI Command: LE Periodic Adve.. (0x08|0x0044) plen 14 #1355 [hci0] 48.314575
Options: 0x0000
Use advertising SID, Advertiser Address Type and address
Reporting initially enabled
SID: 0x02
Adv address type: Random (0x01)
Adv address: 4F:84:84:5F:88:17 (Resolvable)
Identity type: Random (0x01)
Identity: FC:5B:8C:F7:5D:FB (Static)
Skip: 0x0000
Sync timeout: 20000 msec (0x07d0)
Sync CTE type: 0x0000
Signed-off-by: Yang Li <yang.li@amlogic.com>
---
net/bluetooth/hci_sync.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 6687f2a4d1eb..4ea5a87f017d 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2481,6 +2481,10 @@ static int hci_pause_advertising_sync(struct hci_dev *hdev)
int err;
int old_state;
+ /* If controller is not advertising we are done. */
+ if (!hci_dev_test_flag(hdev, HCI_ADVERTISING))
+ return 0;
+
/* If already been paused there is nothing to do. */
if (hdev->advertising_paused)
return 0;
---
base-commit: 6c31dab4ff1e1f4e0f3412efb1cfc88033358d1f
change-id: 20250616-bluetooth_adv-6496e1ca6165
Best regards,
--
Yang Li <yang.li@amlogic.com>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] Bluetooth: Prevent unintended pause by checking if advertising is active
@ 2025-06-16 11:05 ` Yang Li via B4 Relay
0 siblings, 0 replies; 5+ messages in thread
From: Yang Li via B4 Relay @ 2025-06-16 11:05 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
Cc: linux-bluetooth, linux-kernel, Yang Li
From: Yang Li <yang.li@amlogic.com>
When PA Create Sync is enabled, advertising resumes unexpectedly.
Therefore, it's necessary to check whether advertising is currently
active before attempting to pause it.
< HCI Command: LE Add Device To... (0x08|0x0011) plen 7 #1345 [hci0] 48.306205
Address type: Random (0x01)
Address: 4F:84:84:5F:88:17 (Resolvable)
Identity type: Random (0x01)
Identity: FC:5B:8C:F7:5D:FB (Static)
< HCI Command: LE Set Address Re.. (0x08|0x002d) plen 1 #1347 [hci0] 48.308023
Address resolution: Enabled (0x01)
...
< HCI Command: LE Set Extended A.. (0x08|0x0039) plen 6 #1349 [hci0] 48.309650
Extended advertising: Enabled (0x01)
Number of sets: 1 (0x01)
Entry 0
Handle: 0x01
Duration: 0 ms (0x00)
Max ext adv events: 0
...
< HCI Command: LE Periodic Adve.. (0x08|0x0044) plen 14 #1355 [hci0] 48.314575
Options: 0x0000
Use advertising SID, Advertiser Address Type and address
Reporting initially enabled
SID: 0x02
Adv address type: Random (0x01)
Adv address: 4F:84:84:5F:88:17 (Resolvable)
Identity type: Random (0x01)
Identity: FC:5B:8C:F7:5D:FB (Static)
Skip: 0x0000
Sync timeout: 20000 msec (0x07d0)
Sync CTE type: 0x0000
Signed-off-by: Yang Li <yang.li@amlogic.com>
---
net/bluetooth/hci_sync.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 6687f2a4d1eb..4ea5a87f017d 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2481,6 +2481,10 @@ static int hci_pause_advertising_sync(struct hci_dev *hdev)
int err;
int old_state;
+ /* If controller is not advertising we are done. */
+ if (!hci_dev_test_flag(hdev, HCI_ADVERTISING))
+ return 0;
+
/* If already been paused there is nothing to do. */
if (hdev->advertising_paused)
return 0;
---
base-commit: 6c31dab4ff1e1f4e0f3412efb1cfc88033358d1f
change-id: 20250616-bluetooth_adv-6496e1ca6165
Best regards,
--
Yang Li <yang.li@amlogic.com>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: Bluetooth: Prevent unintended pause by checking if advertising is active
2025-06-16 11:05 ` Yang Li via B4 Relay
(?)
@ 2025-06-16 11:32 ` bluez.test.bot
-1 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2025-06-16 11:32 UTC (permalink / raw)
To: linux-bluetooth, yang.li
[-- Attachment #1: Type: text/plain, Size: 2482 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=972465
---Test result---
Test Summary:
CheckPatch PENDING 0.27 seconds
GitLint PENDING 0.22 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 24.99 seconds
CheckAllWarning PASS 27.37 seconds
CheckSparse PASS 30.84 seconds
BuildKernel32 PASS 25.07 seconds
TestRunnerSetup PASS 471.95 seconds
TestRunner_l2cap-tester PASS 25.80 seconds
TestRunner_iso-tester FAIL 8.01 seconds
TestRunner_bnep-tester PASS 6.00 seconds
TestRunner_mgmt-tester FAIL 135.31 seconds
TestRunner_rfcomm-tester PASS 9.67 seconds
TestRunner_sco-tester PASS 15.09 seconds
TestRunner_ioctl-tester PASS 10.30 seconds
TestRunner_mesh-tester PASS 7.47 seconds
TestRunner_smp-tester PASS 8.66 seconds
TestRunner_userchan-tester PASS 6.38 seconds
IncrementalBuild PENDING 0.44 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 480 (98.0%), Failed: 6, Not Run: 4
Failed Test Cases
LL Privacy - Add Device 4 (Disable Adv) Timed out 1.882 seconds
LL Privacy - Set Flags 5 (Multi Adv) Timed out 2.149 seconds
LL Privacy - Set Flags 6 (Multi Dev and Multi Adv) Timed out 2.006 seconds
LL Privacy - Remove Device 4 (Disable Adv) Timed out 2.231 seconds
LL Privacy - Remove Device 5 (Multi Adv) Timed out 1.986 seconds
LL Privacy - Set Device Flag 1 (Device Privacy) Failed 0.174 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Prevent unintended pause by checking if advertising is active
2025-06-16 11:05 ` Yang Li via B4 Relay
(?)
(?)
@ 2025-06-18 13:06 ` Luiz Augusto von Dentz
2025-06-19 2:50 ` Yang Li
-1 siblings, 1 reply; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2025-06-18 13:06 UTC (permalink / raw)
To: yang.li; +Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth, linux-kernel
Hi Yang,
On Mon, Jun 16, 2025 at 7:05 AM Yang Li via B4 Relay
<devnull+yang.li.amlogic.com@kernel.org> wrote:
>
> From: Yang Li <yang.li@amlogic.com>
>
> When PA Create Sync is enabled, advertising resumes unexpectedly.
> Therefore, it's necessary to check whether advertising is currently
> active before attempting to pause it.
>
> < HCI Command: LE Add Device To... (0x08|0x0011) plen 7 #1345 [hci0] 48.306205
> Address type: Random (0x01)
> Address: 4F:84:84:5F:88:17 (Resolvable)
> Identity type: Random (0x01)
> Identity: FC:5B:8C:F7:5D:FB (Static)
> < HCI Command: LE Set Address Re.. (0x08|0x002d) plen 1 #1347 [hci0] 48.308023
> Address resolution: Enabled (0x01)
> ...
> < HCI Command: LE Set Extended A.. (0x08|0x0039) plen 6 #1349 [hci0] 48.309650
> Extended advertising: Enabled (0x01)
> Number of sets: 1 (0x01)
> Entry 0
> Handle: 0x01
> Duration: 0 ms (0x00)
> Max ext adv events: 0
> ...
> < HCI Command: LE Periodic Adve.. (0x08|0x0044) plen 14 #1355 [hci0] 48.314575
> Options: 0x0000
> Use advertising SID, Advertiser Address Type and address
> Reporting initially enabled
> SID: 0x02
> Adv address type: Random (0x01)
> Adv address: 4F:84:84:5F:88:17 (Resolvable)
> Identity type: Random (0x01)
> Identity: FC:5B:8C:F7:5D:FB (Static)
> Skip: 0x0000
> Sync timeout: 20000 msec (0x07d0)
> Sync CTE type: 0x0000
>
> Signed-off-by: Yang Li <yang.li@amlogic.com>
> ---
> net/bluetooth/hci_sync.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index 6687f2a4d1eb..4ea5a87f017d 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -2481,6 +2481,10 @@ static int hci_pause_advertising_sync(struct hci_dev *hdev)
> int err;
> int old_state;
>
> + /* If controller is not advertising we are done. */
> + if (!hci_dev_test_flag(hdev, HCI_ADVERTISING))
> + return 0;
HCI_ADVERTISING is for directed advertising, it shall probably be
changed to HCI_LE_ADV like in hci_disable_advertising_sync.
> /* If already been paused there is nothing to do. */
> if (hdev->advertising_paused)
> return 0;
>
> ---
> base-commit: 6c31dab4ff1e1f4e0f3412efb1cfc88033358d1f
> change-id: 20250616-bluetooth_adv-6496e1ca6165
>
> Best regards,
> --
> Yang Li <yang.li@amlogic.com>
>
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Prevent unintended pause by checking if advertising is active
2025-06-18 13:06 ` [PATCH] " Luiz Augusto von Dentz
@ 2025-06-19 2:50 ` Yang Li
0 siblings, 0 replies; 5+ messages in thread
From: Yang Li @ 2025-06-19 2:50 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth, linux-kernel
Hi Luiz,
> [ EXTERNAL EMAIL ]
>
> Hi Yang,
>
> On Mon, Jun 16, 2025 at 7:05 AM Yang Li via B4 Relay
> <devnull+yang.li.amlogic.com@kernel.org> wrote:
>> From: Yang Li <yang.li@amlogic.com>
>>
>> When PA Create Sync is enabled, advertising resumes unexpectedly.
>> Therefore, it's necessary to check whether advertising is currently
>> active before attempting to pause it.
>>
>> < HCI Command: LE Add Device To... (0x08|0x0011) plen 7 #1345 [hci0] 48.306205
>> Address type: Random (0x01)
>> Address: 4F:84:84:5F:88:17 (Resolvable)
>> Identity type: Random (0x01)
>> Identity: FC:5B:8C:F7:5D:FB (Static)
>> < HCI Command: LE Set Address Re.. (0x08|0x002d) plen 1 #1347 [hci0] 48.308023
>> Address resolution: Enabled (0x01)
>> ...
>> < HCI Command: LE Set Extended A.. (0x08|0x0039) plen 6 #1349 [hci0] 48.309650
>> Extended advertising: Enabled (0x01)
>> Number of sets: 1 (0x01)
>> Entry 0
>> Handle: 0x01
>> Duration: 0 ms (0x00)
>> Max ext adv events: 0
>> ...
>> < HCI Command: LE Periodic Adve.. (0x08|0x0044) plen 14 #1355 [hci0] 48.314575
>> Options: 0x0000
>> Use advertising SID, Advertiser Address Type and address
>> Reporting initially enabled
>> SID: 0x02
>> Adv address type: Random (0x01)
>> Adv address: 4F:84:84:5F:88:17 (Resolvable)
>> Identity type: Random (0x01)
>> Identity: FC:5B:8C:F7:5D:FB (Static)
>> Skip: 0x0000
>> Sync timeout: 20000 msec (0x07d0)
>> Sync CTE type: 0x0000
>>
>> Signed-off-by: Yang Li <yang.li@amlogic.com>
>> ---
>> net/bluetooth/hci_sync.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
>> index 6687f2a4d1eb..4ea5a87f017d 100644
>> --- a/net/bluetooth/hci_sync.c
>> +++ b/net/bluetooth/hci_sync.c
>> @@ -2481,6 +2481,10 @@ static int hci_pause_advertising_sync(struct hci_dev *hdev)
>> int err;
>> int old_state;
>>
>> + /* If controller is not advertising we are done. */
>> + if (!hci_dev_test_flag(hdev, HCI_ADVERTISING))
>> + return 0;
> HCI_ADVERTISING is for directed advertising, it shall probably be
> changed to HCI_LE_ADV like in hci_disable_advertising_sync.
Thanks for your valuable feedback.
I will do.
>> /* If already been paused there is nothing to do. */
>> if (hdev->advertising_paused)
>> return 0;
>>
>> ---
>> base-commit: 6c31dab4ff1e1f4e0f3412efb1cfc88033358d1f
>> change-id: 20250616-bluetooth_adv-6496e1ca6165
>>
>> Best regards,
>> --
>> Yang Li <yang.li@amlogic.com>
>>
>>
>
> --
> Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-19 2:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 11:05 [PATCH] Bluetooth: Prevent unintended pause by checking if advertising is active Yang Li
2025-06-16 11:05 ` Yang Li via B4 Relay
2025-06-16 11:32 ` bluez.test.bot
2025-06-18 13:06 ` [PATCH] " Luiz Augusto von Dentz
2025-06-19 2:50 ` Yang Li
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.