summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_conn.c
diff options
context:
space:
mode:
authorAlain Michaud <alainm@chromium.org>2022-06-02 17:30:03 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-07-22 02:04:53 +0200
commit629f66aaca81ad713fb05f1d12acc827510601b3 (patch)
tree5ca3eab87431eb437bf176260918513b8d9c1348 /net/bluetooth/hci_conn.c
parentBluetooth: hci_bcm: Add support for FW loading in autobaud mode (diff)
downloadlinux-629f66aaca81ad713fb05f1d12acc827510601b3.tar.xz
linux-629f66aaca81ad713fb05f1d12acc827510601b3.zip
Bluetooth: clear the temporary linkkey in hci_conn_cleanup
If a hardware error occurs and the connections are flushed without a disconnection_complete event being signaled, the temporary linkkeys are not flushed. This change ensures that any outstanding flushable linkkeys are flushed when the connection are flushed from the hash table. Additionally, this also makes use of test_and_clear_bit to avoid multiple attempts to delete the link key that's already been flushed. Signed-off-by: Alain Michaud <alainm@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r--net/bluetooth/hci_conn.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index ac06c9724c7f..7829433d54c1 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -118,6 +118,9 @@ static void hci_conn_cleanup(struct hci_conn *conn)
if (test_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags))
hci_conn_params_del(conn->hdev, &conn->dst, conn->dst_type);
+ if (test_and_clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
+ hci_remove_link_key(hdev, &conn->dst);
+
hci_chan_list_flush(conn);
hci_conn_hash_del(hdev, conn);