Skip to contentSkip to conversation

Bluetooth: Fix updating SMP remote key distribution information

PATCH New [email protected] 2 participants 3 messages Mar 14, 2014

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

PATCH 1/1 Bluetooth: Fix updating SMP remote key distribution information

From: Johan Hedberg <[email protected]>

When performing pairing using SMP the remote may clear any key distribution bits it wants in its pairing response. We must therefore update our local variable accordingly, otherwise we might get stuck waiting for keys that will never come.

---
 net/bluetooth/smp.c | 5 +++++
 1 file changed, 5 insertions(+)
net/bluetooth/smp.c +5 -0
index 74a17cf91b26..8a1b1bf79555 100644
@@ -748,6 +748,11 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
 	smp->prsp[0] = SMP_CMD_PAIRING_RSP;
 	memcpy(&smp->prsp[1], rsp, sizeof(*rsp));
 
+	/* Update remote key distribution in case the remote cleared
+	 * some bits that we had enabled in our request.
+	 */
+	smp->remote_key_dist &= rsp->resp_key_dist;
+
 	if ((req->auth_req & SMP_AUTH_BONDING) &&
 	    (rsp->auth_req & SMP_AUTH_BONDING))
 		auth = SMP_AUTH_BONDING;
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH 1/1 Bluetooth: Fix updating SMP remote key distribution information

From: Johan Hedberg <[email protected]>

When performing pairing using SMP the remote may clear any key distribution bits it wants in its pairing response. We must therefore update our local variable accordingly, otherwise we might get stuck waiting for keys that will never come.

---
 net/bluetooth/smp.c | 5 +++++
 1 file changed, 5 insertions(+)
net/bluetooth/smp.c +5 -0
index 74a17cf91b26..8a1b1bf79555 100644
@@ -748,6 +748,11 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
 	smp->prsp[0] = SMP_CMD_PAIRING_RSP;
 	memcpy(&smp->prsp[1], rsp, sizeof(*rsp));
 
+	/* Update remote key distribution in case the remote cleared
+	 * some bits that we had enabled in our request.
+	 */
+	smp->remote_key_dist &= rsp->resp_key_dist;
+
 	if ((req->auth_req & SMP_AUTH_BONDING) &&
 	    (rsp->auth_req & SMP_AUTH_BONDING))
 		auth = SMP_AUTH_BONDING;
Signature · 1 line
1.8.5.3
maintainer
#2 lore raw

Hi Johan,

Quoted 9 lines

When performing pairing using SMP the remote may clear any key distribution bits it wants in its pairing response. We must therefore update our local variable accordingly, otherwise we might get stuck waiting for keys that will never come.

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

1 file changed, 5 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel