Browse Source

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 <johan.hedberg@silabs.com>
(cherry picked from commit bf363d7c3e)
pull/74122/head
Johan Hedberg 1 year ago committed by Chris Friedt
parent
commit
baed41e525
  1. 6
      subsys/bluetooth/host/hci_core.c

6
subsys/bluetooth/host/hci_core.c

@ -1756,6 +1756,12 @@ static void hci_encrypt_change(struct net_buf *buf) @@ -1756,6 +1756,12 @@ static void hci_encrypt_change(struct net_buf *buf)
return;
}
if (conn->encrypt == evt->encrypt) {
BT_WARN("No change to encryption state (encrypt 0x%02x)", evt->encrypt);
bt_conn_unref(conn);
return;
}
conn->encrypt = evt->encrypt;
#if defined(CONFIG_BT_SMP)

Loading…
Cancel
Save