mirror-linux/include/net/bluetooth
Luiz Augusto von Dentz c82b6357a5 Bluetooth: hci_event: Fix not using key encryption size when its known
This fixes the regression introduced by 50c1241e6a8a ("Bluetooth: l2cap:
Check encryption key size on incoming connection") introduced a check for
l2cap_check_enc_key_size which checks for hcon->enc_key_size which may
not be initialized if HCI_OP_READ_ENC_KEY_SIZE is still pending.

If the key encryption size is known, due previously reading it using
HCI_OP_READ_ENC_KEY_SIZE, then store it as part of link_key/smp_ltk
structures so the next time the encryption is changed their values are
used as conn->enc_key_size thus avoiding the racing against
HCI_OP_READ_ENC_KEY_SIZE.

Now that the enc_size is stored as part of key the information the code
then attempts to check that there is no downgrade of security if
HCI_OP_READ_ENC_KEY_SIZE returns a value smaller than what has been
previously stored.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=220061
Link: https://bugzilla.kernel.org/show_bug.cgi?id=220063
Fixes: 522e9ed157 ("Bluetooth: l2cap: Check encryption key size on incoming connection")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2025-05-08 10:24:15 -04:00
..
bluetooth.h Bluetooth: ISO: add TX timestamping 2025-03-25 12:50:07 -04:00
coredump.h Bluetooth: Add support for hci devcoredump 2023-04-23 21:57:59 -07:00
hci.h Bluetooth: hci_conn: Fix not setting timeout for BIG Create Sync 2025-04-25 15:03:19 -04:00
hci_core.h Bluetooth: hci_event: Fix not using key encryption size when its known 2025-05-08 10:24:15 -04:00
hci_mon.h Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name 2023-10-13 20:06:33 -07:00
hci_sock.h Bluetooth: hci_core: Prefer struct_size over open coded arithmetic 2024-07-14 21:33:29 -04:00
hci_sync.h Bluetooth: hci_conn: Fix not setting timeout for BIG Create Sync 2025-04-25 15:03:19 -04:00
iso.h Bluetooth: ISO: Add broadcast support 2022-07-22 17:14:13 -07:00
l2cap.h Bluetooth: L2CAP: add TX timestamping 2025-03-25 12:50:35 -04:00
mgmt.h Bluetooth: MGMT: Add LL Privacy Setting 2025-03-25 15:22:49 -04:00
rfcomm.h tty: rfcomm: prefer struct_size over open coded arithmetic 2024-07-14 21:33:31 -04:00
sco.h Bluetooth: af_bluetooth: Make BT_PKT_STATUS generic 2023-08-11 11:49:16 -07:00