diff options
| author | Greg Kroah-Hartman <gregkh@google.com> | 2020-10-17 12:36:27 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@google.com> | 2020-10-17 12:36:27 +0200 |
| commit | 887cae0a5083d67ca72016144a8e72258f41877c (patch) | |
| tree | 3dda5ca5c102298ea0144114c9c9b60026293bcf /include | |
| parent | c7826d812d44a1ed7fd920955c4b84759eda92e5 (diff) | |
| parent | d98913ec3269a460636da0e4e8c72f594fb756c0 (diff) | |
Merge 4.4.240 into android-4.4-p
Changes in 4.4.240
Bluetooth: A2MP: Fix not initializing all members
Bluetooth: MGMT: Fix not checking if BT_HS is enabled
Bluetooth: fix kernel oops in store_pending_adv_report
Bluetooth: Consolidate encryption handling in hci_encrypt_cfm
Bluetooth: Fix update of connection state in `hci_encrypt_cfm`
Bluetooth: Disconnect if E0 is used for Level 4
media: usbtv: Fix refcounting mixup
USB: serial: option: add Cellient MPL200 card
USB: serial: option: Add Telit FT980-KS composition
staging: comedi: check validity of wMaxPacketSize of usb endpoints found
USB: serial: pl2303: add device-id for HP GC device
USB: serial: ftdi_sio: add support for FreeCalypso JTAG+UART adapters
reiserfs: Initialize inode keys properly
reiserfs: Fix oops during mount
spi: unbinding slave before calling spi_destroy_queue
crypto: qat - check cipher length for aead AES-CBC-HMAC-SHA
Linux 4.4.240
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I194dca828914f8573fbdf725f353775c934a2423
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7c0c83dfe86e..5aaf6cdb121a 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1235,16 +1235,34 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) conn->security_cfm_cb(conn, status); } -static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, - __u8 encrypt) +static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status) { struct hci_cb *cb; + __u8 encrypt; + + if (conn->state == BT_CONFIG) { + if (!status) + conn->state = BT_CONNECTED; - if (conn->sec_level == BT_SECURITY_SDP) - conn->sec_level = BT_SECURITY_LOW; + hci_connect_cfm(conn, status); + hci_conn_drop(conn); + return; + } - if (conn->pending_sec_level > conn->sec_level) - conn->sec_level = conn->pending_sec_level; + if (!test_bit(HCI_CONN_ENCRYPT, &conn->flags)) + encrypt = 0x00; + else if (test_bit(HCI_CONN_AES_CCM, &conn->flags)) + encrypt = 0x02; + else + encrypt = 0x01; + + if (!status) { + if (conn->sec_level == BT_SECURITY_SDP) + conn->sec_level = BT_SECURITY_LOW; + + if (conn->pending_sec_level > conn->sec_level) + conn->sec_level = conn->pending_sec_level; + } mutex_lock(&hci_cb_list_lock); list_for_each_entry(cb, &hci_cb_list, list) { |
