linux/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
..
bnep Bluetooth: bnep: fix wild-memory-access in proto_unregister 2024-10-16 16:10:03 -04:00
cmtp
hidp treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
rfcomm treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
6lowpan.c Bluetooth: L2CAP: add TX timestamping 2025-03-25 12:50:35 -04:00
Kconfig
Makefile
af_bluetooth.c Including fixes from netfiler, xfrm and bluetooth. 2024-10-24 16:43:50 -07:00
aosp.c
aosp.h
coredump.c HCI: coredump: Log devcd dumps into the monitor 2025-03-25 12:47:49 -04:00
ecdh_helper.c
ecdh_helper.h
eir.c
eir.h
hci_codec.c
hci_codec.h
hci_conn.c Bluetooth: hci_event: Fix not using key encryption size when its known 2025-05-08 10:24:15 -04:00
hci_core.c Bluetooth: add support for skb TX SND/COMPLETION timestamping 2025-03-25 12:49:38 -04:00
hci_debugfs.c
hci_debugfs.h
hci_event.c Bluetooth: hci_event: Fix not using key encryption size when its known 2025-05-08 10:24:15 -04:00
hci_sock.c Bluetooth: Improve setsockopt() handling of malformed user input 2024-12-11 11:54:57 -05:00
hci_sync.c Bluetooth: hci_conn: Fix not setting timeout for BIG Create Sync 2025-04-25 15:03:19 -04:00
hci_sysfs.c Bluetooth: Allow reset via sysfs 2025-01-15 10:37:07 -05:00
iso.c Bluetooth: hci_conn: Fix not setting timeout for BIG Create Sync 2025-04-25 15:03:19 -04:00
l2cap_core.c Bluetooth: L2CAP: copy RX timestamp to new fragments 2025-04-25 15:03:19 -04:00
l2cap_sock.c Bluetooth: L2CAP: add TX timestamping 2025-03-25 12:50:35 -04:00
leds.c
leds.h
lib.c
mgmt.c Bluetooth: MGMT: Fix MGMT_OP_ADD_DEVICE invalid device flags 2025-05-07 12:47:53 -04:00
mgmt_config.c
mgmt_config.h
mgmt_util.c Bluetooth: MGMT: Remove unused mgmt_pending_find_data 2025-03-25 12:30:43 -04:00
mgmt_util.h Bluetooth: MGMT: Remove unused mgmt_pending_find_data 2025-03-25 12:30:43 -04:00
msft.c
msft.h
sco.c Bluetooth: SCO: add TX timestamping 2025-03-25 12:50:54 -04:00
selftest.c
selftest.h
smp.c Bluetooth: L2CAP: add TX timestamping 2025-03-25 12:50:35 -04:00
smp.h