diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 954b29605c94249bdc509c45f6cfd56f38ba5985..ea02adecaa7ec3063f091ce13828071cfc6f5185 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -4767,9 +4767,11 @@ static void hci_user_passkey_notify_evt(struct hci_dev *hdev, BT_DBG("%s", hdev->name); + hci_dev_lock(hdev); + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); if (!conn) - return; + goto unlock; conn->passkey_notify = __le32_to_cpu(ev->passkey); conn->passkey_entered = 0; @@ -4778,6 +4780,9 @@ static void hci_user_passkey_notify_evt(struct hci_dev *hdev, mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, conn->dst_type, conn->passkey_notify, conn->passkey_entered); + +unlock: + hci_dev_unlock(hdev); } static void hci_keypress_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) @@ -4787,14 +4792,16 @@ static void hci_keypress_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) BT_DBG("%s", hdev->name); + hci_dev_lock(hdev); + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); if (!conn) - return; + goto unlock; switch (ev->type) { case HCI_KEYPRESS_STARTED: conn->passkey_entered = 0; - return; + goto unlock; case HCI_KEYPRESS_ENTERED: conn->passkey_entered++; @@ -4809,13 +4816,16 @@ static void hci_keypress_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) break; case HCI_KEYPRESS_COMPLETED: - return; + goto unlock; } if (hci_dev_test_flag(hdev, HCI_MGMT)) mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, conn->dst_type, conn->passkey_notify, conn->passkey_entered); + +unlock: + hci_dev_unlock(hdev); } static void hci_simple_pair_complete_evt(struct hci_dev *hdev,