Bluetooth: hci_sync: Disable legacy instance's ext adv before setup snapshot
Subsystems (2)
PATCH 1/1 Bluetooth: hci_sync: Disable legacy instance's ext adv before setup snapshot
hci_setup_ext_adv_instance_sync(...) only disabled HCI_OP_LE_SET_EXT_ADV_ENABLE before setup snapshot in case of non-legacy instances (instance > 0) and never disabled the same for legacy instance (instance == 0). This would lead to failure in setting ext adv params with HCI_ERROR_COMMAND_DISALLOWED (0x0c) error like below, when toggling the discoverable/connectable property of a controller with advertising enabled.
``` $ btmgmt advertising off hci0 Set Advertising complete, settings: powered ssp br/edr le secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt connectable on hci0 Set Connectable complete, settings: powered connectable ssp br/edr le secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt connectable off hci0 Set Connectable complete, settings: powered ssp br/edr le secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt advertising on hci0 Set Advertising complete, settings: powered connectable ssp br/edr le advertising secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt connectable on Set Connectable for hci0 failed with status 0x0a (Busy) $ btmgmt connectable off Set Connectable for hci0 failed with status 0x0a (Busy) $ dmesg ... [ 21.970527] hci0: Opcode 0x2036 [ 21.970529] hci0: opcode 0x2036 plen 25 [ 21.970537] hci0: skb len 28 [ 21.970539] hci0: length 1 [ 21.976099] hci0: result 0x0c [ 21.976105] hci0: end: err -16 [ 21.976114] Bluetooth: hci0: Opcode 0x2036 failed: -16 ```
--- net/bluetooth/hci_sync.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
net/bluetooth/hci_sync.c +30 -0
@@ -1144,6 +1144,32 @@ int hci_update_random_address_sync(struct hci_dev *hdev, bool require_privacy,return 0 ; } +static int hci_disable_ext_adv_legacy_instance_sync (struct hci_dev *hdev) +{ +struct hci_cp_le_set_ext_adv_enable *cp; +struct hci_cp_ext_adv_set *set; +u8 data[sizeof (*cp) +sizeof (*set) *1 ]; +u8 size; + +if (!hci_dev_test_flag (hdev,HCI_LE_ADV_0 )) +return 0 ; + +memset (data,0 ,sizeof (data)); + + cp = (void *)data; + set = (void *)cp->data; + + cp->num_of_sets =0x01 ; + cp->enable =0x00 ; + + set->handle =0x00 ; + + size =sizeof (*cp) +sizeof (*set) * cp->num_of_sets; + +return __hci_cmd_sync_status (hdev,HCI_OP_LE_SET_EXT_ADV_ENABLE , + size, data,HCI_CMD_TIMEOUT ); +} +static int hci_disable_ext_adv_instance_sync (struct hci_dev *hdev,u8 instance) {struct hci_cp_le_set_ext_adv_enable *cp;
@@ -1369,6 +1395,10 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)return -EINVAL ; } }else { + err =hci_disable_ext_adv_legacy_instance_sync (hdev); +if (err) +return err; + adv =NULL ; }
Signature · 1 line
2.53.0
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=1140346
---Test result---
Test Summary:
CheckPatch PASS 2.80 seconds VerifyFixes PASS 0.12 seconds VerifySignedoff PASS 0.12 seconds GitLint PASS 0.37 seconds SubjectPrefix PASS 0.11 seconds BuildKernel PASS 28.90 seconds CheckAllWarning PASS 31.57 seconds CheckSparse PASS 30.04 seconds BuildKernel32 PASS 26.60 seconds CheckKernelLLVM SKIP 0.00 seconds TestRunnerSetup PASS 500.76 seconds TestRunner_l2cap-tester PASS 64.82 seconds TestRunner_iso-tester PASS 82.42 seconds TestRunner_bnep-tester PASS 19.48 seconds TestRunner_mgmt-tester FAIL 221.70 seconds TestRunner_rfcomm-tester PASS 25.07 seconds TestRunner_sco-tester PASS 30.88 seconds TestRunner_ioctl-tester PASS 26.60 seconds TestRunner_mesh-tester FAIL 25.88 seconds TestRunner_smp-tester PASS 23.62 seconds TestRunner_userchan-tester PASS 24.52 seconds TestRunner_6lowpan-tester PASS 23.11 seconds IncrementalBuild PASS 24.89 seconds
Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis Output:
Clang not found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 501, Passed: 494 (98.6%), Failed: 3, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.248 seconds LL Privacy - Unpair 1 Timed out 1.864 seconds LL Privacy - Unpair 2 (Remove from AL) Timed out 5.004 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 2.748 seconds Mesh - Send cancel - 2 Timed out 1.987 seconds
https://github.com/bluez/bluetooth-next/pull/532
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 18 lines · On Wed, 5 Aug 2026 01:40:51 +0530 you wrote:
hci_setup_ext_adv_instance_sync(...)only disabledHCI_OP_LE_SET_EXT_ADV_ENABLEbefore setup snapshot in case of non-legacy instances (instance > 0) and never disabled the same for legacy instance (instance == 0). This would lead to failure in setting ext adv params withHCI_ERROR_COMMAND_DISALLOWED(0x0c) error like below, when toggling the discoverable/connectable property of a controller with advertising enabled.
```$ btmgmt advertising off hci0 Set Advertising complete, settings: powered ssp br/edr le secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt connectable on hci0 Set Connectable complete, settings: powered connectable ssp br/edr le secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt connectable off hci0 Set Connectable complete, settings: powered ssp br/edr le secure-conn wide-band-speech cis-central cis-peripheral
Quoted 1 line
[...]
Here is the summary with links:
- Bluetooth: hci_sync: Disable legacy instance's ext adv before setup snapshot
https://git.kernel.org/bluetooth/bluetooth-next/c/2d4711f5ad1b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html