Skip to content
/ linux Public

Commit 9118601

Browse files
VudentzSasha Levin
authored andcommitted
Bluetooth: L2CAP: Fix missing key size check for L2CAP_LE_CONN_REQ
[ Upstream commit 138d7ec ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 21842c0 commit 9118601

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

net/bluetooth/l2cap_core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5913,6 +5913,13 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
59135913
goto response_unlock;
59145914
}
59155915

5916+
/* Check if Key Size is sufficient for the security level */
5917+
if (!l2cap_check_enc_key_size(conn->hcon, pchan)) {
5918+
result = L2CAP_CR_LE_BAD_KEY_SIZE;
5919+
chan = NULL;
5920+
goto response_unlock;
5921+
}
5922+
59165923
/* Check for valid dynamic CID range */
59175924
if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_LE_DYN_END) {
59185925
result = L2CAP_CR_LE_INVALID_SCID;

0 commit comments

Comments
 (0)