Message ID | ZXbWcZPq_2zIbqEO@alexlu (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] Bluetooth: Add more enc key size check | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | success | Gitlint PASS |
tedd_an/SubjectPrefix | success | Gitlint PASS |
tedd_an/BuildKernel | success | BuildKernel PASS |
tedd_an/CheckAllWarning | success | CheckAllWarning PASS |
tedd_an/CheckSparse | success | CheckSparse PASS |
tedd_an/CheckSmatch | success | CheckSparse PASS |
tedd_an/BuildKernel32 | success | BuildKernel32 PASS |
tedd_an/TestRunnerSetup | success | TestRunnerSetup PASS |
tedd_an/TestRunner_l2cap-tester | success | TestRunner PASS |
tedd_an/TestRunner_iso-tester | success | TestRunner PASS |
tedd_an/TestRunner_bnep-tester | success | TestRunner PASS |
tedd_an/TestRunner_mgmt-tester | success | TestRunner PASS |
tedd_an/TestRunner_rfcomm-tester | success | TestRunner PASS |
tedd_an/TestRunner_sco-tester | success | TestRunner PASS |
tedd_an/TestRunner_ioctl-tester | success | TestRunner PASS |
tedd_an/TestRunner_mesh-tester | success | TestRunner PASS |
tedd_an/TestRunner_smp-tester | success | TestRunner PASS |
tedd_an/TestRunner_userchan-tester | success | TestRunner PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=808718 ---Test result--- Test Summary: CheckPatch PASS 0.48 seconds GitLint PASS 0.21 seconds SubjectPrefix PASS 0.07 seconds BuildKernel PASS 27.52 seconds CheckAllWarning PASS 30.74 seconds CheckSparse PASS 36.91 seconds CheckSmatch PASS 99.35 seconds BuildKernel32 PASS 27.19 seconds TestRunnerSetup PASS 430.58 seconds TestRunner_l2cap-tester PASS 24.23 seconds TestRunner_iso-tester PASS 45.04 seconds TestRunner_bnep-tester PASS 7.09 seconds TestRunner_mgmt-tester PASS 160.98 seconds TestRunner_rfcomm-tester PASS 11.03 seconds TestRunner_sco-tester PASS 14.59 seconds TestRunner_ioctl-tester PASS 12.19 seconds TestRunner_mesh-tester PASS 8.72 seconds TestRunner_smp-tester PASS 9.77 seconds TestRunner_userchan-tester PASS 7.32 seconds IncrementalBuild PASS 25.72 seconds --- Regards, Linux Bluetooth
Hi Alex, On Mon, Dec 11, 2023 at 4:57 AM <bluez.test.bot@gmail.com> wrote: > > This is automated email and please do not reply to this email! > > Dear submitter, > > Thank you for submitting the patches to the linux bluetooth mailing list. > This is a CI test results with your patch series: > PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=808718 > > ---Test result--- > > Test Summary: > CheckPatch PASS 0.48 seconds > GitLint PASS 0.21 seconds > SubjectPrefix PASS 0.07 seconds > BuildKernel PASS 27.52 seconds > CheckAllWarning PASS 30.74 seconds > CheckSparse PASS 36.91 seconds > CheckSmatch PASS 99.35 seconds > BuildKernel32 PASS 27.19 seconds > TestRunnerSetup PASS 430.58 seconds > TestRunner_l2cap-tester PASS 24.23 seconds > TestRunner_iso-tester PASS 45.04 seconds > TestRunner_bnep-tester PASS 7.09 seconds > TestRunner_mgmt-tester PASS 160.98 seconds > TestRunner_rfcomm-tester PASS 11.03 seconds > TestRunner_sco-tester PASS 14.59 seconds > TestRunner_ioctl-tester PASS 12.19 seconds > TestRunner_mesh-tester PASS 8.72 seconds > TestRunner_smp-tester PASS 9.77 seconds > TestRunner_userchan-tester PASS 7.32 seconds > IncrementalBuild PASS 25.72 seconds > How about doing the following: diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 2ad7b9f86f74..f9a8fb9fcce2 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -750,9 +750,12 @@ static u8 hci_cc_read_enc_key_size(struct hci_dev *hdev, void *data, } else { conn->enc_key_size = rp->key_size; status = 0; + + if (conn->enc_key_size < hdev->min_enc_key_size) + status = HCI_ERROR_AUTH_FAILURE; } - hci_encrypt_cfm(conn, 0); + hci_encrypt_cfm(conn, status); done: hci_dev_unlock(hdev); That way we don't have to proliferate the checks over to L2CAP, etc, so we consider that the encryption itself fails if the conn->enc_key_size < hdev->min_enc_key_size. > > --- > Regards, > Linux Bluetooth >
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 17ca13e8c044..a9809fbe6b00 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1669,7 +1669,13 @@ static void l2cap_conn_start(struct l2cap_conn *conn) rsp.dcid = cpu_to_le16(chan->scid); if (l2cap_chan_check_security(chan, false)) { - if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) { + if (!l2cap_check_enc_key_size(conn->hcon)) { + l2cap_state_change(chan, BT_DISCONN); + __set_chan_timer(chan, + L2CAP_DISC_TIMEOUT); + rsp.result = cpu_to_le16(L2CAP_CR_SEC_BLOCK); + rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); + } else if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) { rsp.result = cpu_to_le16(L2CAP_CR_PEND); rsp.status = cpu_to_le16(L2CAP_CS_AUTHOR_PEND); chan->ops->defer(chan); @@ -4202,7 +4208,15 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn, if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE) { if (l2cap_chan_check_security(chan, false)) { - if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) { + /* As slave role, we should check the enc key size when + * l2cap conn req is received. + */ + if (!l2cap_check_enc_key_size(conn->hcon)) { + l2cap_state_change(chan, BT_DISCONN); + __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); + result = L2CAP_CR_SEC_BLOCK; + status = L2CAP_CS_NO_INFO; + } else if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) { l2cap_state_change(chan, BT_CONNECT2); result = L2CAP_CR_PEND; status = L2CAP_CS_AUTHOR_PEND;