Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: hci_sync: Don't enable instance 0 on Set Connectable
@ 2026-11-22 19:19 Simon Mikuda
  2026-11-22 22:55 ` [v2] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-22 19:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda, Marcel Holtmann, Luiz Augusto von Dentz

After the current advertising instance is removed, cur_adv_instance
is 0. On an extended advertising controller the next Set Connectable
then starts advertising instance 0, although the Advertising setting
is off.

Steps to reproduce, on a controller with extended advertising and
bluetoothd stopped:

  btmgmt advertising off
  btmgmt connectable off
  btmgmt add-adv -d 06097465737431 1
  btmgmt add-adv -d 06097465737432 2
  btmgmt rm-adv 2
  btmgmt connectable on

btmon shows LE Set Extended Advertising Enable for Handle 0x00.

Only update the advertising parameters when the Advertising setting is
on or there is a current instance.

Fixes: de181e887ac2 ("Bluetooth: Impmlement extended adv enable")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
Changes in v2:
previous patch was written for an older kernel

since 1bfecdbd0317 cur_adv_instance is set when an instance is enabled, so the
bug now only shows after the current instance is removed, and the reproducer
is updated to that case.

 net/bluetooth/hci_sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 638589f77081..2ff2511d8c3d 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -6649,7 +6649,7 @@ int hci_update_connectable_sync(struct hci_dev *hdev)
 
 	/* Update the advertising parameters if necessary */
 	if (hci_dev_test_flag(hdev, HCI_ADVERTISING) ||
-	    !list_empty(&hdev->adv_instances)) {
+	    hdev->cur_adv_instance) {
 		if (ext_adv_capable(hdev))
 			err = hci_start_ext_adv_sync(hdev,
 						     hdev->cur_adv_instance);

base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
-- 
2.43.0


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 19:19 [PATCH v2] Bluetooth: hci_sync: Don't enable instance 0 on Set Connectable Simon Mikuda
2026-11-22 22:55 ` [v2] " 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