Message ID | ZXfFyoEhCj_S70qp@alexlu (mailing list archive) |
---|---|
State | Accepted |
Commit | 19921189d442ce100e78730c31c00cc969d2619a |
Headers | show |
Series | [v3] 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 | warning | CheckSparse WARNING net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h): |
tedd_an/CheckSmatch | warning | CheckSparse WARNING net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h): |
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 | fail | TestRunner_mgmt-tester: Total: 497, Passed: 496 (99.8%), Failed: 1, Not Run: 0 |
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=809021 ---Test result--- Test Summary: CheckPatch PASS 0.66 seconds GitLint PASS 0.34 seconds SubjectPrefix PASS 0.13 seconds BuildKernel PASS 27.61 seconds CheckAllWarning PASS 30.37 seconds CheckSparse WARNING 36.53 seconds CheckSmatch WARNING 98.92 seconds BuildKernel32 PASS 27.25 seconds TestRunnerSetup PASS 421.86 seconds TestRunner_l2cap-tester PASS 22.96 seconds TestRunner_iso-tester PASS 46.60 seconds TestRunner_bnep-tester PASS 7.02 seconds TestRunner_mgmt-tester FAIL 167.54 seconds TestRunner_rfcomm-tester PASS 11.14 seconds TestRunner_sco-tester PASS 14.67 seconds TestRunner_ioctl-tester PASS 12.00 seconds TestRunner_mesh-tester PASS 8.92 seconds TestRunner_smp-tester PASS 9.93 seconds TestRunner_userchan-tester PASS 7.33 seconds IncrementalBuild PASS 26.08 seconds Details ############################## Test: CheckSparse - WARNING Desc: Run sparse tool with linux kernel Output: net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h): ############################## Test: CheckSmatch - WARNING Desc: Run smatch tool with source Output: net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h): ############################## Test: TestRunner_mgmt-tester - FAIL Desc: Run mgmt-tester with test-runner Output: Total: 497, Passed: 496 (99.8%), Failed: 1, Not Run: 0 Failed Test Cases Pairing Acceptor - SMP over BR/EDR 1 Timed out 1.996 seconds --- Regards, Linux Bluetooth
Hello: This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Tue, 12 Dec 2023 10:30:34 +0800 you wrote: > From: Alex Lu <alex_lu@realsil.com.cn> > > When we are slave role and receives l2cap conn req when encryption has > started, we should check the enc key size to avoid KNOB attack or BLUFFS > attack. > From SIG recommendation, implementations are advised to reject > service-level connections on an encrypted baseband link with key > strengths below 7 octets. > A simple and clear way to achieve this is to place the enc key size > check in hci_cc_read_enc_key_size() > > [...] Here is the summary with links: - [v3] Bluetooth: Add more enc key size check https://git.kernel.org/bluetooth/bluetooth-next/c/19921189d442 You are awesome, thank you!
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 2ad7b9f86f74..ef8c3bed7361 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -750,9 +750,23 @@ 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) { + /* As slave role, the conn->state has been set to + * BT_CONNECTED and l2cap conn req might not be received + * yet, at this moment the l2cap layer almost does + * nothing with the non-zero status. + * So we also clear encrypt related bits, and then the + * handler of l2cap conn req will get the right secure + * state at a later time. + */ + status = HCI_ERROR_AUTH_FAILURE; + clear_bit(HCI_CONN_ENCRYPT, &conn->flags); + clear_bit(HCI_CONN_AES_CCM, &conn->flags); + } } - hci_encrypt_cfm(conn, 0); + hci_encrypt_cfm(conn, status); done: hci_dev_unlock(hdev);