GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bluetooth: Add more enc key size check · frank-w/BPI-Router-Linux@0f7bffd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • net/bluetooth
    • hci_event.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎net/bluetooth/hci_event.c‎

Copy file name to clipboardExpand all lines: net/bluetooth/hci_event.c
+15-1Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,23 @@ static u8 hci_cc_read_enc_key_size(struct hci_dev *hdev, void *data,
749749
} else {
750750
conn->enc_key_size = rp->key_size;
751751
status = 0;
752+
753+
if (conn->enc_key_size < hdev->min_enc_key_size) {
754+
/* As slave role, the conn->state has been set to
755+
* BT_CONNECTED and l2cap conn req might not be received
756+
* yet, at this moment the l2cap layer almost does
757+
* nothing with the non-zero status.
758+
* So we also clear encrypt related bits, and then the
759+
* handler of l2cap conn req will get the right secure
760+
* state at a later time.
761+
*/
762+
status = HCI_ERROR_AUTH_FAILURE;
763+
clear_bit(HCI_CONN_ENCRYPT, &conn->flags);
764+
clear_bit(HCI_CONN_AES_CCM, &conn->flags);
765+
}
752766
}
753767

754-
hci_encrypt_cfm(conn, 0);
768+
hci_encrypt_cfm(conn, status);
755769

756770
done:
757771
hci_dev_unlock(hdev);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.