Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e213568a authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg
Browse files

Bluetooth: Disallow LE local out-of-band data when LE privacy is used



When the LE pivacy feature is used, then pairing has to happen based
on resolvable random addresses (RPA), but currently there is no clean
way to retrieve the correct RPA. So instead of returning an outdated
RPA, just disallow this command when LE privacy is in use.

Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 1b9441f8
Loading
Loading
Loading
Loading
+19 −6
Original line number Original line Diff line number Diff line
@@ -6526,10 +6526,23 @@ static int read_local_oob_ext_data(struct sock *sk, struct hci_dev *hdev,
			goto complete;
			goto complete;
		}
		}


		/* This should return the active RPA, but since the RPA
		 * is only programmed on demand, it is really hard to fill
		 * this in at the moment. For now disallow retrieving
		 * local out-of-band data when privacy is in use.
		 *
		 * Returning the identity address will not help here since
		 * pairing happens before the identity resolving key is
		 * known and thus the connection establishment happens
		 * based on the RPA and not the identity address.
		 */
		if (hci_dev_test_flag(hdev, HCI_PRIVACY)) {
		if (hci_dev_test_flag(hdev, HCI_PRIVACY)) {
			memcpy(addr, &hdev->rpa, 6);
			hci_dev_unlock(hdev);
			addr[6] = 0x01;
			status = MGMT_STATUS_REJECTED;
		} else if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ||
			goto complete;
		}

		if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ||
		   !bacmp(&hdev->bdaddr, BDADDR_ANY) ||
		   !bacmp(&hdev->bdaddr, BDADDR_ANY) ||
		   (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) &&
		   (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) &&
		    bacmp(&hdev->static_addr, BDADDR_ANY))) {
		    bacmp(&hdev->static_addr, BDADDR_ANY))) {