Bluetooth: Fix Deadlock on Legacy Scan/Pair
Fix nested calls to hci_dev_lock().
Signed-off-by: Brian Gix <bgix@codeaurora.org>
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 1e59cb3..2276428 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3088,12 +3088,16 @@
num_reports = skb->data[0];
ev = (void *) &skb->data[1];
+ hci_dev_lock(hdev);
+
while (num_reports--) {
mgmt_device_found(hdev->id, &ev->bdaddr, ev->bdaddr_type,
1, NULL, 0, ev->length, ev->data);
hci_add_adv_entry(hdev, ev);
ev = (void *) (ev->data + ev->length + 1);
}
+
+ hci_dev_unlock(hdev);
}
static inline void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb)