diff options
Diffstat (limited to 'net/bluetooth/hci_event.c')
| -rw-r--r-- | net/bluetooth/hci_event.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 0437200d92f4..8db3e89fae35 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -2904,15 +2904,16 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, | |||
| 2904 | hci_conn_add_sysfs(conn); | 2904 | hci_conn_add_sysfs(conn); |
| 2905 | break; | 2905 | break; |
| 2906 | 2906 | ||
| 2907 | case 0x0d: /* Connection Rejected due to Limited Resources */ | ||
| 2907 | case 0x11: /* Unsupported Feature or Parameter Value */ | 2908 | case 0x11: /* Unsupported Feature or Parameter Value */ |
| 2908 | case 0x1c: /* SCO interval rejected */ | 2909 | case 0x1c: /* SCO interval rejected */ |
| 2909 | case 0x1a: /* Unsupported Remote Feature */ | 2910 | case 0x1a: /* Unsupported Remote Feature */ |
| 2910 | case 0x1f: /* Unspecified error */ | 2911 | case 0x1f: /* Unspecified error */ |
| 2911 | if (conn->out && conn->attempt < 2) { | 2912 | if (conn->out) { |
| 2912 | conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | | 2913 | conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | |
| 2913 | (hdev->esco_type & EDR_ESCO_MASK); | 2914 | (hdev->esco_type & EDR_ESCO_MASK); |
| 2914 | hci_setup_sync(conn, conn->link->handle); | 2915 | if (hci_setup_sync(conn, conn->link->handle)) |
| 2915 | goto unlock; | 2916 | goto unlock; |
| 2916 | } | 2917 | } |
| 2917 | /* fall through */ | 2918 | /* fall through */ |
| 2918 | 2919 | ||
| @@ -3024,17 +3025,20 @@ unlock: | |||
| 3024 | static u8 hci_get_auth_req(struct hci_conn *conn) | 3025 | static u8 hci_get_auth_req(struct hci_conn *conn) |
| 3025 | { | 3026 | { |
| 3026 | /* If remote requests dedicated bonding follow that lead */ | 3027 | /* If remote requests dedicated bonding follow that lead */ |
| 3027 | if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) { | 3028 | if (conn->remote_auth == HCI_AT_DEDICATED_BONDING || |
| 3029 | conn->remote_auth == HCI_AT_DEDICATED_BONDING_MITM) { | ||
| 3028 | /* If both remote and local IO capabilities allow MITM | 3030 | /* If both remote and local IO capabilities allow MITM |
| 3029 | * protection then require it, otherwise don't */ | 3031 | * protection then require it, otherwise don't */ |
| 3030 | if (conn->remote_cap == 0x03 || conn->io_capability == 0x03) | 3032 | if (conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT || |
| 3031 | return 0x02; | 3033 | conn->io_capability == HCI_IO_NO_INPUT_OUTPUT) |
| 3034 | return HCI_AT_DEDICATED_BONDING; | ||
| 3032 | else | 3035 | else |
| 3033 | return 0x03; | 3036 | return HCI_AT_DEDICATED_BONDING_MITM; |
| 3034 | } | 3037 | } |
| 3035 | 3038 | ||
| 3036 | /* If remote requests no-bonding follow that lead */ | 3039 | /* If remote requests no-bonding follow that lead */ |
| 3037 | if (conn->remote_auth == 0x00 || conn->remote_auth == 0x01) | 3040 | if (conn->remote_auth == HCI_AT_NO_BONDING || |
| 3041 | conn->remote_auth == HCI_AT_NO_BONDING_MITM) | ||
| 3038 | return conn->remote_auth | (conn->auth_type & 0x01); | 3042 | return conn->remote_auth | (conn->auth_type & 0x01); |
| 3039 | 3043 | ||
| 3040 | return conn->auth_type; | 3044 | return conn->auth_type; |
| @@ -3066,7 +3070,7 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
| 3066 | /* Change the IO capability from KeyboardDisplay | 3070 | /* Change the IO capability from KeyboardDisplay |
| 3067 | * to DisplayYesNo as it is not supported by BT spec. */ | 3071 | * to DisplayYesNo as it is not supported by BT spec. */ |
| 3068 | cp.capability = (conn->io_capability == 0x04) ? | 3072 | cp.capability = (conn->io_capability == 0x04) ? |
| 3069 | 0x01 : conn->io_capability; | 3073 | HCI_IO_DISPLAY_YESNO : conn->io_capability; |
| 3070 | conn->auth_type = hci_get_auth_req(conn); | 3074 | conn->auth_type = hci_get_auth_req(conn); |
| 3071 | cp.authentication = conn->auth_type; | 3075 | cp.authentication = conn->auth_type; |
| 3072 | 3076 | ||
| @@ -3140,7 +3144,8 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
| 3140 | * request. The only exception is when we're dedicated bonding | 3144 | * request. The only exception is when we're dedicated bonding |
| 3141 | * initiators (connect_cfm_cb set) since then we always have the MITM | 3145 | * initiators (connect_cfm_cb set) since then we always have the MITM |
| 3142 | * bit set. */ | 3146 | * bit set. */ |
| 3143 | if (!conn->connect_cfm_cb && loc_mitm && conn->remote_cap == 0x03) { | 3147 | if (!conn->connect_cfm_cb && loc_mitm && |
| 3148 | conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) { | ||
| 3144 | BT_DBG("Rejecting request: remote device can't provide MITM"); | 3149 | BT_DBG("Rejecting request: remote device can't provide MITM"); |
| 3145 | hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY, | 3150 | hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY, |
| 3146 | sizeof(ev->bdaddr), &ev->bdaddr); | 3151 | sizeof(ev->bdaddr), &ev->bdaddr); |
| @@ -3148,8 +3153,8 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
| 3148 | } | 3153 | } |
| 3149 | 3154 | ||
| 3150 | /* If no side requires MITM protection; auto-accept */ | 3155 | /* If no side requires MITM protection; auto-accept */ |
| 3151 | if ((!loc_mitm || conn->remote_cap == 0x03) && | 3156 | if ((!loc_mitm || conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) && |
| 3152 | (!rem_mitm || conn->io_capability == 0x03)) { | 3157 | (!rem_mitm || conn->io_capability == HCI_IO_NO_INPUT_OUTPUT)) { |
| 3153 | 3158 | ||
| 3154 | /* If we're not the initiators request authorization to | 3159 | /* If we're not the initiators request authorization to |
| 3155 | * proceed from user space (mgmt_user_confirm with | 3160 | * proceed from user space (mgmt_user_confirm with |
| @@ -3552,7 +3557,11 @@ static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
| 3552 | cp.handle = cpu_to_le16(conn->handle); | 3557 | cp.handle = cpu_to_le16(conn->handle); |
| 3553 | 3558 | ||
| 3554 | if (ltk->authenticated) | 3559 | if (ltk->authenticated) |
| 3555 | conn->sec_level = BT_SECURITY_HIGH; | 3560 | conn->pending_sec_level = BT_SECURITY_HIGH; |
| 3561 | else | ||
| 3562 | conn->pending_sec_level = BT_SECURITY_MEDIUM; | ||
| 3563 | |||
| 3564 | conn->enc_key_size = ltk->enc_size; | ||
| 3556 | 3565 | ||
| 3557 | hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp); | 3566 | hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp); |
| 3558 | 3567 | ||
