Skip to contentSkip to conversation

Bluetooth: Fix MITM flag when initiating SMP pairing

PATCH In review [email protected] 2 participants 2 messages Mar 18, 2014

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

PATCH 1/1 Bluetooth: Fix MITM flag when initiating SMP pairing

From: Johan Hedberg <[email protected]>

The pairing process initiated through mgmt sets the conn->auth_type value regardless of BR/EDR or LE pairing. This value will contain the MITM flag if the local IO capability allows it. When sending the SMP pairing request we should check the value and ensure that the MITM bit gets correctly set in the bonding flags.

---
 net/bluetooth/smp.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/bluetooth/smp.c +6 -0
index 6f29430c29c4..a0150033e797 100644
@@ -909,6 +909,12 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
 
 	authreq = seclevel_to_authreq(sec_level);
 
+	/* hcon->auth_type is set by pair_device in mgmt.c. If the MITM
+	 * flag is set we should also set it for the SMP request.
+	 */
+	if ((hcon->auth_type & 0x01))
+		authreq |= SMP_AUTH_MITM;
+
 	if (hcon->link_mode & HCI_LM_MASTER) {
 		struct smp_cmd_pairing cp;
 
Signature · 1 line
1.8.5.3
maintainer
#1 lore raw

Hi Johan,

Quoted 10 lines

The pairing process initiated through mgmt sets the conn->auth_type value regardless of BR/EDR or LE pairing. This value will contain the MITM flag if the local IO capability allows it. When sending the SMP pairing request we should check the value and ensure that the MITM bit gets correctly set in the bonding flags.

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

1 file changed, 6 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel