|
@@ -2332,7 +2332,7 @@ static u8 hci_to_mgmt_reason(u8 err)
|
|
|
static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
|
|
{
|
|
|
struct hci_ev_disconn_complete *ev = (void *) skb->data;
|
|
|
- u8 reason = hci_to_mgmt_reason(ev->reason);
|
|
|
+ u8 reason;
|
|
|
struct hci_conn_params *params;
|
|
|
struct hci_conn *conn;
|
|
|
bool mgmt_connected;
|
|
@@ -2355,6 +2355,12 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
|
|
conn->state = BT_CLOSED;
|
|
|
|
|
|
mgmt_connected = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags);
|
|
|
+
|
|
|
+ if (test_bit(HCI_CONN_AUTH_FAILURE, &conn->flags))
|
|
|
+ reason = MGMT_DEV_DISCONN_AUTH_FAILURE;
|
|
|
+ else
|
|
|
+ reason = hci_to_mgmt_reason(ev->reason);
|
|
|
+
|
|
|
mgmt_device_disconnected(hdev, &conn->dst, conn->type, conn->dst_type,
|
|
|
reason, mgmt_connected);
|
|
|
|
|
@@ -2421,6 +2427,8 @@ static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
|
|
goto unlock;
|
|
|
|
|
|
if (!ev->status) {
|
|
|
+ clear_bit(HCI_CONN_AUTH_FAILURE, &conn->flags);
|
|
|
+
|
|
|
if (!hci_conn_ssp_enabled(conn) &&
|
|
|
test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) {
|
|
|
BT_INFO("re-auth of legacy device is not possible.");
|
|
@@ -2429,6 +2437,9 @@ static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
|
|
conn->sec_level = conn->pending_sec_level;
|
|
|
}
|
|
|
} else {
|
|
|
+ if (ev->status == HCI_ERROR_PIN_OR_KEY_MISSING)
|
|
|
+ set_bit(HCI_CONN_AUTH_FAILURE, &conn->flags);
|
|
|
+
|
|
|
mgmt_auth_failed(conn, ev->status);
|
|
|
}
|
|
|
|
|
@@ -2613,6 +2624,9 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
|
|
clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
|
|
|
|
|
|
if (ev->status && conn->state == BT_CONNECTED) {
|
|
|
+ if (ev->status == HCI_ERROR_PIN_OR_KEY_MISSING)
|
|
|
+ set_bit(HCI_CONN_AUTH_FAILURE, &conn->flags);
|
|
|
+
|
|
|
hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE);
|
|
|
hci_conn_drop(conn);
|
|
|
goto unlock;
|