mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: Prevent unintended pause by checking if advertising is active
@ 2025-06-19  3:01 Yang Li via B4 Relay
  2025-06-23 19:10 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li via B4 Relay @ 2025-06-19  3:01 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>
---
Changes in v2:
- Replace HCI_ADVERTISING with HCI_LE_ADV
- Link to v1: https://lore.kernel.org/r/20250616-bluetooth_adv-v1-1-6876bf4e85b4@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..42d3696227af 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_LE_ADV))
+		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	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] Bluetooth: Prevent unintended pause by checking if advertising is active
  2025-06-19  3:01 [PATCH v2] Bluetooth: Prevent unintended pause by checking if advertising is active Yang Li via B4 Relay
@ 2025-06-23 19:10 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2025-06-23 19:10 UTC (permalink / raw)
  To: Yang Li; +Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel

Hello:

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

On Thu, 19 Jun 2025 11:01:07 +0800 you 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
> 
> [...]

Here is the summary with links:
  - [v2] Bluetooth: Prevent unintended pause by checking if advertising is active
    https://git.kernel.org/bluetooth/bluetooth-next/c/8466ce07cb6a

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

end of thread, other threads:[~2025-06-23 19:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-19  3:01 [PATCH v2] Bluetooth: Prevent unintended pause by checking if advertising is active Yang Li via B4 Relay
2025-06-23 19:10 ` 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

all inboxes | Powered by JetHome®