Skip to content

Commit 5582bf9

Browse files
jhedberganangl
authored andcommitted
[nrf fromtree] Bluetooth: Host: Avoid processing "no change" encryption changes
If the new encryption state is the same as the old one, there's no point in doing additional processing or callbacks. Simply log a warning and ignore the HCI event in such a case. Signed-off-by: Johan Hedberg <[email protected]> (cherry picked from commit bf363d7) Signed-off-by: Vinayak Kariappa [email protected] <[email protected]>
1 parent 9dadf11 commit 5582bf9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

subsys/bluetooth/host/hci_core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,6 +2092,12 @@ static void hci_encrypt_change(struct net_buf *buf)
20922092
return;
20932093
}
20942094

2095+
if (conn->encrypt == evt->encrypt) {
2096+
LOG_WRN("No change to encryption state (encrypt 0x%02x)", evt->encrypt);
2097+
bt_conn_unref(conn);
2098+
return;
2099+
}
2100+
20952101
conn->encrypt = evt->encrypt;
20962102

20972103
#if defined(CONFIG_BT_SMP)

0 commit comments

Comments
 (0)