Skip to contentSkip to conversation

Bluetooth: Fix valid Identity Address check

PATCH In review Johan Hedberg 2 participants 2 messages Jan 14, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Fix valid Identity Address check

From: Johan Hedberg <[email protected]>

According to the Bluetooth core specification valid identity addresses are either Public Device Addresses or Static Random Addresses. IRKs received with any other type of address should be discarded since we cannot assume to know the permanent identity of the peer device.

This patch fixes a missing check for the Identity Address when receiving the Identity Address Information SMP PDU.

---
 net/bluetooth/smp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/bluetooth/smp.c +5 -1
index 379654e70e6f..04e49f8f0982 100644
@@ -2305,8 +2305,12 @@ static int smp_cmd_ident_addr_info(struct l2cap_conn *conn,
 	 * implementations are not known of and in order to not over
 	 * complicate our implementation, simply pretend that we never
 	 * received an IRK for such a device.
+	 *
+	 * The Identity Address must also be a Static Random or Public
+	 * Address, which hci_is_identity_address() checks for.
 	 */
-	if (!bacmp(&info->bdaddr, BDADDR_ANY)) {
+	if (!bacmp(&info->bdaddr, BDADDR_ANY) ||
+	    !hci_is_identity_address(&info->bdaddr, info->addr_type)) {
 		BT_ERR("Ignoring IRK with no identity address");
 		goto distribute;
 	}
Signature · 1 line
2.1.0
maintainer
#1 lore raw

Hi Johan,

Quoted 5 lines

According to the Bluetooth core specification valid identity addresses are either Public Device Addresses or Static Random Addresses. IRKs received with any other type of address should be discarded since we cannot assume to know the permanent identity of the peer device.

Quoted 8 lines

This patch fixes a missing check for the Identity Address when receiving the Identity Address Information SMP PDU.

---
net/bluetooth/smp.c | 6 +++++-

1 file changed, 5 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel