Skip to content

Commit 138d7ec

Browse files
committed
Bluetooth: L2CAP: Fix missing key size check for L2CAP_LE_CONN_REQ
This adds a check for encryption key size upon receiving L2CAP_LE_CONN_REQ which is required by L2CAP/LE/CFC/BV-15-C which expects L2CAP_CR_LE_BAD_KEY_SIZE. Link: https://lore.kernel.org/linux-bluetooth/5782243.rdbgypaU67@n9w6sw14/ Fixes: 27e2d4c ("Bluetooth: Add basic LE L2CAP connect request receiving support") Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Tested-by: Christian Eggers <ceggers@arri.de>
1 parent a8d1d73 commit 138d7ec

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

net/bluetooth/l2cap_core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4916,6 +4916,13 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
49164916
goto response_unlock;
49174917
}
49184918

4919+
/* Check if Key Size is sufficient for the security level */
4920+
if (!l2cap_check_enc_key_size(conn->hcon, pchan)) {
4921+
result = L2CAP_CR_LE_BAD_KEY_SIZE;
4922+
chan = NULL;
4923+
goto response_unlock;
4924+
}
4925+
49194926
/* Check for valid dynamic CID range */
49204927
if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_LE_DYN_END) {
49214928
result = L2CAP_CR_LE_INVALID_SCID;

0 commit comments

Comments
 (0)