Skip to content

Commit a9a3476

Browse files
Vudentzholtmann
authored andcommitted
Bluetooth: MGMT: Add conditions for setting HCI_CONN_FLAG_REMOTE_WAKEUP
HCI_CONN_FLAG_REMOTE_WAKEUP can only be set if device can be programmed in the allowlist which in case of device using RPA requires LL Privacy support to be enabled. Link: https://bugzilla.kernel.org/show_bug.cgi?id=215768 Signed-off-by: Luiz Augusto von Dentz <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent baabb7f commit a9a3476

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

net/bluetooth/mgmt.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4529,6 +4529,23 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
45294529
params = hci_conn_params_lookup(hdev, &cp->addr.bdaddr,
45304530
le_addr_type(cp->addr.type));
45314531
if (params) {
4532+
DECLARE_BITMAP(flags, __HCI_CONN_NUM_FLAGS);
4533+
4534+
bitmap_from_u64(flags, current_flags);
4535+
4536+
/* Devices using RPAs can only be programmed in the
4537+
* acceptlist LL Privacy has been enable otherwise they
4538+
* cannot mark HCI_CONN_FLAG_REMOTE_WAKEUP.
4539+
*/
4540+
if (test_bit(HCI_CONN_FLAG_REMOTE_WAKEUP, flags) &&
4541+
!use_ll_privacy(hdev) &&
4542+
hci_find_irk_by_addr(hdev, &params->addr,
4543+
params->addr_type)) {
4544+
bt_dev_warn(hdev,
4545+
"Cannot set wakeable for RPA");
4546+
goto unlock;
4547+
}
4548+
45324549
bitmap_from_u64(params->flags, current_flags);
45334550
status = MGMT_STATUS_SUCCESS;
45344551

@@ -4545,6 +4562,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
45454562
}
45464563
}
45474564

4565+
unlock:
45484566
hci_dev_unlock(hdev);
45494567

45504568
done:

0 commit comments

Comments
 (0)