Skip to content

Commit 8f2b8ba

Browse files
committed
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 6477a75 commit 8f2b8ba

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
@@ -1756,6 +1756,12 @@ static void hci_encrypt_change(struct net_buf *buf)
17561756
return;
17571757
}
17581758

1759+
if (conn->encrypt == evt->encrypt) {
1760+
BT_WARN("No change to encryption state (encrypt 0x%02x)", evt->encrypt);
1761+
bt_conn_unref(conn);
1762+
return;
1763+
}
1764+
17591765
conn->encrypt = evt->encrypt;
17601766

17611767
#if defined(CONFIG_BT_SMP)

0 commit comments

Comments
 (0)