Skip to content

Commit

Permalink
Bluetooth: MGMT: Add conditions for setting HCI_CONN_FLAG_REMOTE_WAKEUP
Browse files Browse the repository at this point in the history
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 <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Luiz Augusto von Dentz authored and Marcel Holtmann committed May 13, 2022
1 parent baabb7f commit a9a3476
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4529,6 +4529,23 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
params = hci_conn_params_lookup(hdev, &cp->addr.bdaddr,
le_addr_type(cp->addr.type));
if (params) {
DECLARE_BITMAP(flags, __HCI_CONN_NUM_FLAGS);

bitmap_from_u64(flags, current_flags);

/* Devices using RPAs can only be programmed in the
* acceptlist LL Privacy has been enable otherwise they
* cannot mark HCI_CONN_FLAG_REMOTE_WAKEUP.
*/
if (test_bit(HCI_CONN_FLAG_REMOTE_WAKEUP, flags) &&
!use_ll_privacy(hdev) &&
hci_find_irk_by_addr(hdev, &params->addr,
params->addr_type)) {
bt_dev_warn(hdev,
"Cannot set wakeable for RPA");
goto unlock;
}

bitmap_from_u64(params->flags, current_flags);
status = MGMT_STATUS_SUCCESS;

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

unlock:
hci_dev_unlock(hdev);

done:
Expand Down

0 comments on commit a9a3476

Please sign in to comment.