Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_sync: Fix start/stop logic of default advertising
@ 2026-11-22 14:54 Simon Mikuda
  2026-11-22 17:33 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-22 14:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda, Marcel Holtmann, Luiz Augusto von Dentz

Default advertising (instance 0x00) was started even when it shouldn't.
Setup:
* adapter that supports extended commands
* connectable off
* advertising off

Steps to reproduce:
* add advertising with instance 1
* set connectable on

The kernel started advertising with instance 0x00, even when the
advertising property is off. We should only update the default
advertisement when the proper flag is set, and that is HCI_ADVERTISING.

Other advertisements (with instance > 0) have a separate connectable
flag, so we shouldn't update them at all when the connectable property
changes.

Fixes: 37adf701dd87 ("Bluetooth: Add per-instance adv disable/remove")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 net/bluetooth/hci_sync.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 638589f77081..efcca81ce284 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -6648,11 +6648,9 @@ int hci_update_connectable_sync(struct hci_dev *hdev)
 		err = hci_update_adv_data_sync(hdev, hdev->cur_adv_instance);
 
 	/* Update the advertising parameters if necessary */
-	if (hci_dev_test_flag(hdev, HCI_ADVERTISING) ||
-	    !list_empty(&hdev->adv_instances)) {
+	if (hci_dev_test_flag(hdev, HCI_ADVERTISING)) {
 		if (ext_adv_capable(hdev))
-			err = hci_start_ext_adv_sync(hdev,
-						     hdev->cur_adv_instance);
+			err = hci_start_ext_adv_sync(hdev, 0x00);
 		else
 			err = hci_enable_advertising_sync(hdev);
 

base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
-- 
2.43.0


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

end of thread, other threads:[~2026-11-22 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 14:54 [PATCH] Bluetooth: hci_sync: Fix start/stop logic of default advertising Simon Mikuda
2026-11-22 17:33 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox