Bluetooth: hci_sync: Fix not using correct handle
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 15 May 2024 14:32:01 +0000 (10:32 -0400)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 10 Jun 2024 13:48:25 +0000 (09:48 -0400)
When setting up an advertisement the code shall always attempt to use
the handle set by the instance since it may not be equal to the instance
ID.

Fixes: e77f43d531af ("Bluetooth: hci_core: Fix not handling hdev->le_num_of_adv_sets=1")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/hci_sync.c

index 16daa79b7981f9b74135c79eb26dceb549d77641..a8a7d2b368701b70585ea6cd7a24d5a0c3d5fed1 100644 (file)
@@ -1194,7 +1194,7 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
 
        cp.own_addr_type = own_addr_type;
        cp.channel_map = hdev->le_adv_channel_map;
-       cp.handle = instance;
+       cp.handle = adv ? adv->handle : instance;
 
        if (flags & MGMT_ADV_FLAG_SEC_2M) {
                cp.primary_phy = HCI_ADV_PHY_1M;