aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-03-24 08:39:04 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-03-24 10:51:55 -0400
commit81d0c8ad7163d9860374e38a75e2e99d00ac8c17 (patch)
treeb4c132d043cc5fb1c77566b42085112a3f4df9ba /net/bluetooth
parent0a66cf203676f794084c6a97189eb41565bfd6aa (diff)
Bluetooth: Add missing cmd_status handler for LE_Start_Encryption
It is possible that the HCI_LE_Start_Encryption command fails in an early stage and triggers a command status event with the failure code. In such a case we need to properly notify the hci_conn object and cleanly bring the connection down. This patch adds the missing command status handler for this HCI command. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_event.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 9ee081b9c064..49774912cb01 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1725,6 +1725,36 @@ unlock:
1725 hci_dev_unlock(hdev); 1725 hci_dev_unlock(hdev);
1726} 1726}
1727 1727
1728static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status)
1729{
1730 struct hci_cp_le_start_enc *cp;
1731 struct hci_conn *conn;
1732
1733 BT_DBG("%s status 0x%2.2x", hdev->name, status);
1734
1735 if (!status)
1736 return;
1737
1738 hci_dev_lock(hdev);
1739
1740 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_START_ENC);
1741 if (!cp)
1742 goto unlock;
1743
1744 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle));
1745 if (!conn)
1746 goto unlock;
1747
1748 if (conn->state != BT_CONNECTED)
1749 goto unlock;
1750
1751 hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE);
1752 hci_conn_drop(conn);
1753
1754unlock:
1755 hci_dev_unlock(hdev);
1756}
1757
1728static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 1758static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
1729{ 1759{
1730 __u8 status = *((__u8 *) skb->data); 1760 __u8 status = *((__u8 *) skb->data);
@@ -2636,6 +2666,10 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
2636 hci_cs_le_create_conn(hdev, ev->status); 2666 hci_cs_le_create_conn(hdev, ev->status);
2637 break; 2667 break;
2638 2668
2669 case HCI_OP_LE_START_ENC:
2670 hci_cs_le_start_enc(hdev, ev->status);
2671 break;
2672
2639 default: 2673 default:
2640 BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); 2674 BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode);
2641 break; 2675 break;