]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: hci_sync: Fix using random address for BIG/PA advertisements
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 19 Sep 2025 16:30:05 +0000 (12:30 -0400)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Sat, 27 Sep 2025 15:37:43 +0000 (11:37 -0400)
When creating an advertisement for BIG the address shall not be
non-resolvable since in case of acting as BASS/Broadcast Assistant the
address must be the same as the connection in order to use the PAST
method and even when PAST/BASS are not in the picture a Periodic
Advertisement can still be synchronized thus the same argument as to
connectable advertisements still stand.

Fixes: eca0ae4aea66 ("Bluetooth: Add initial implementation of BIS connections")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
net/bluetooth/hci_sync.c

index 7a7d4989085848b112446be8d1491fcce35172dd..eefdb6134ca53b96e9fe9c17bec2b21c56977af0 100644 (file)
@@ -1325,7 +1325,7 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
 {
        struct hci_cp_le_set_ext_adv_params cp;
        struct hci_rp_le_set_ext_adv_params rp;
-       bool connectable;
+       bool connectable, require_privacy;
        u32 flags;
        bdaddr_t random_addr;
        u8 own_addr_type;
@@ -1363,10 +1363,12 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
                return -EPERM;
 
        /* Set require_privacy to true only when non-connectable
-        * advertising is used. In that case it is fine to use a
-        * non-resolvable private address.
+        * advertising is used and it is not periodic.
+        * In that case it is fine to use a non-resolvable private address.
         */
-       err = hci_get_random_address(hdev, !connectable,
+       require_privacy = !connectable && !(adv && adv->periodic);
+
+       err = hci_get_random_address(hdev, require_privacy,
                                     adv_use_rpa(hdev, flags), adv,
                                     &own_addr_type, &random_addr);
        if (err < 0)