* [PATCH] Bluetooth: L2CAP: Fix missing key size check for L2CAP_ECRED_CONN_REQ
@ 2026-11-27 12:12 Simon Mikuda
2026-11-27 14:03 ` bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-27 12:12 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda, Marcel Holtmann, Luiz Augusto von Dentz
The encryption key size of L2CAP_LE_CONN_REQ is checked since
commit 138d7eca445e ("Bluetooth: L2CAP: Fix missing key size check for
L2CAP_LE_CONN_REQ"), but the one of L2CAP_ECRED_CONN_REQ is not: a
channel of the enhanced credit based mode is accepted over an encrypted
link whose key is shorter than the minimum.
PTS L2CAP/ECFC/BV-15-C, the twin of L2CAP/LE/CFC/BV-15-C, pairs with a
15-octet key and expects an IUT that requires 16 octets to refuse the
channel with L2CAP_CR_LE_BAD_KEY_SIZE (0x0007). It gets Connection
Successful (0x0000).
Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
net/bluetooth/l2cap_core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index da947b65d26a..a9ac91e03fbb 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5525,6 +5525,12 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
goto unlock;
}
+ /* Check if Key Size is sufficient for the security level */
+ if (!l2cap_check_enc_key_size(conn->hcon, pchan)) {
+ result = L2CAP_CR_LE_BAD_KEY_SIZE;
+ goto unlock;
+ }
+
/* Check if the listening channel has set an output MTU then the
* requested MTU shall be less than or equal to that value.
*/
base-commit: 77bc0f253ff9fe1656f6e0fe9e9f5d3da91faf60
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 14:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 12:12 [PATCH] Bluetooth: L2CAP: Fix missing key size check for L2CAP_ECRED_CONN_REQ Simon Mikuda
2026-11-27 14:03 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox