@@ -1411,7 +1411,8 @@ static void l2cap_request_info(struct l2cap_conn *conn)
1411
1411
sizeof (req ), & req );
1412
1412
}
1413
1413
1414
- static bool l2cap_check_enc_key_size (struct hci_conn * hcon )
1414
+ static bool l2cap_check_enc_key_size (struct hci_conn * hcon ,
1415
+ struct l2cap_chan * chan )
1415
1416
{
1416
1417
/* The minimum encryption key size needs to be enforced by the
1417
1418
* host stack before establishing any L2CAP connections. The
@@ -1425,7 +1426,7 @@ static bool l2cap_check_enc_key_size(struct hci_conn *hcon)
1425
1426
int min_key_size = hcon -> hdev -> min_enc_key_size ;
1426
1427
1427
1428
/* On FIPS security level, key size must be 16 bytes */
1428
- if (hcon -> sec_level == BT_SECURITY_FIPS )
1429
+ if (chan -> sec_level == BT_SECURITY_FIPS )
1429
1430
min_key_size = 16 ;
1430
1431
1431
1432
return (!test_bit (HCI_CONN_ENCRYPT , & hcon -> flags ) ||
@@ -1453,7 +1454,7 @@ static void l2cap_do_start(struct l2cap_chan *chan)
1453
1454
!__l2cap_no_conn_pending (chan ))
1454
1455
return ;
1455
1456
1456
- if (l2cap_check_enc_key_size (conn -> hcon ))
1457
+ if (l2cap_check_enc_key_size (conn -> hcon , chan ))
1457
1458
l2cap_start_connection (chan );
1458
1459
else
1459
1460
__set_chan_timer (chan , L2CAP_DISC_TIMEOUT );
@@ -1528,7 +1529,7 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
1528
1529
continue ;
1529
1530
}
1530
1531
1531
- if (l2cap_check_enc_key_size (conn -> hcon ))
1532
+ if (l2cap_check_enc_key_size (conn -> hcon , chan ))
1532
1533
l2cap_start_connection (chan );
1533
1534
else
1534
1535
l2cap_chan_close (chan , ECONNREFUSED );
@@ -3992,7 +3993,7 @@ static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
3992
3993
/* Check if the ACL is secure enough (if not SDP) */
3993
3994
if (psm != cpu_to_le16 (L2CAP_PSM_SDP ) &&
3994
3995
(!hci_conn_check_link_mode (conn -> hcon ) ||
3995
- !l2cap_check_enc_key_size (conn -> hcon ))) {
3996
+ !l2cap_check_enc_key_size (conn -> hcon , pchan ))) {
3996
3997
conn -> disc_reason = HCI_ERROR_AUTH_FAILURE ;
3997
3998
result = L2CAP_CR_SEC_BLOCK ;
3998
3999
goto response ;
@@ -7352,7 +7353,7 @@ static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
7352
7353
}
7353
7354
7354
7355
if (chan -> state == BT_CONNECT ) {
7355
- if (!status && l2cap_check_enc_key_size (hcon ))
7356
+ if (!status && l2cap_check_enc_key_size (hcon , chan ))
7356
7357
l2cap_start_connection (chan );
7357
7358
else
7358
7359
__set_chan_timer (chan , L2CAP_DISC_TIMEOUT );
@@ -7362,7 +7363,7 @@ static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
7362
7363
struct l2cap_conn_rsp rsp ;
7363
7364
__u16 res , stat ;
7364
7365
7365
- if (!status && l2cap_check_enc_key_size (hcon )) {
7366
+ if (!status && l2cap_check_enc_key_size (hcon , chan )) {
7366
7367
if (test_bit (FLAG_DEFER_SETUP , & chan -> flags )) {
7367
7368
res = L2CAP_CR_PEND ;
7368
7369
stat = L2CAP_CS_AUTHOR_PEND ;
0 commit comments