Commit bf363d7c authored by Johan Hedberg's avatar Johan Hedberg Committed by Anas Nashif
Browse files

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: default avatarJohan Hedberg <johan.hedberg@silabs.com>
parent bab7df9f
Loading
Loading
Loading
Loading
+6 −0
Changes for subsys/bluetooth/host/hci_core.c: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2141,6 +2141,12 @@ static void hci_encrypt_change(struct net_buf *buf)
		return;
	}

	if (conn->encrypt == evt->encrypt) {
		LOG_WRN("No change to encryption state (encrypt 0x%02x)", evt->encrypt);
		bt_conn_unref(conn);
		return;
	}

	conn->encrypt = evt->encrypt;

#if defined(CONFIG_BT_SMP)