Skip to content

Commit 64e759f

Browse files
sjancholtmann
authored andcommitted
Bluetooth: Fix missing encryption refresh on Security Request
If Security Request is received on connection that is already encrypted with sufficient security master should perform encryption key refresh procedure instead of just ignoring Slave Security Request (Core Spec 5.0 Vol 3 Part H 2.4.6). > ACL Data RX: Handle 3585 flags 0x02 dlen 6 SMP: Security Request (0x0b) len 1 Authentication requirement: Bonding, No MITM, SC, No Keypresses (0x09) < HCI Command: LE Start Encryption (0x08|0x0019) plen 28 Handle: 3585 Random number: 0x0000000000000000 Encrypted diversifier: 0x0000 Long term key: 44264272a5c426a9e868f034cf0e69f3 > HCI Event: Command Status (0x0f) plen 4 LE Start Encryption (0x08|0x0019) ncmd 1 Status: Success (0x00) > HCI Event: Encryption Key Refresh Complete (0x30) plen 3 Status: Success (0x00) Handle: 3585 Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 0c6e526 commit 64e759f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

net/bluetooth/smp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2296,8 +2296,14 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
22962296
else
22972297
sec_level = authreq_to_seclevel(auth);
22982298

2299-
if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK))
2299+
if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) {
2300+
/* If link is already encrypted with sufficient security we
2301+
* still need refresh encryption as per Core Spec 5.0 Vol 3,
2302+
* Part H 2.4.6
2303+
*/
2304+
smp_ltk_encrypt(conn, hcon->sec_level);
23002305
return 0;
2306+
}
23012307

23022308
if (sec_level > hcon->pending_sec_level)
23032309
hcon->pending_sec_level = sec_level;

0 commit comments

Comments
 (0)