Skip to content

Commit fee8920

Browse files
jhedberghenrikbrixandersen
authored andcommitted
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)
1 parent 8cd7337 commit fee8920

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
@@ -2062,6 +2062,12 @@ static void hci_encrypt_change(struct net_buf *buf)
20622062
return;
20632063
}
20642064

2065+
if (conn->encrypt == evt->encrypt) {
2066+
LOG_WRN("No change to encryption state (encrypt 0x%02x)", evt->encrypt);
2067+
bt_conn_unref(conn);
2068+
return;
2069+
}
2070+
20652071
conn->encrypt = evt->encrypt;
20662072

20672073
#if defined(CONFIG_BT_SMP)

0 commit comments

Comments
 (0)