aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-02-16 15:59:05 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2014-02-17 08:58:14 -0500
commit490cb0b318a0619ae545e63d6773f01caf29d4a0 (patch)
tree2970f9f27ea6ff46a5080b63fcfbab2b7a76dd05 /net/bluetooth/mgmt.c
parent9113bfd82dc8ece9cbb898df8794f58a78a36e97 (diff)
Bluetooth: Restrict long term keys to public and static addresses
The long term keys should be associated with an identity address. Valid identity addresses are public addresses or static addresses. So only allow these two as valid address information for long term keys. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ce7ef339b1c4..70bef3d5db57 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4162,9 +4162,19 @@ static bool ltk_is_valid(struct mgmt_ltk_info *key)
4162{ 4162{
4163 if (key->master != 0x00 && key->master != 0x01) 4163 if (key->master != 0x00 && key->master != 0x01)
4164 return false; 4164 return false;
4165 if (!bdaddr_type_is_le(key->addr.type)) 4165
4166 return false; 4166 switch (key->addr.type) {
4167 return true; 4167 case BDADDR_LE_PUBLIC:
4168 return true;
4169
4170 case BDADDR_LE_RANDOM:
4171 /* Two most significant bits shall be set */
4172 if ((key->addr.bdaddr.b[5] & 0xc0) != 0xc0)
4173 return false;
4174 return true;
4175 }
4176
4177 return false;
4168} 4178}
4169 4179
4170static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev, 4180static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,