bluetooth: Add HCI device to device list after initialization
Avoid possible NULL pointer dereference when ioctl is called while device is not fully initailized Change-Id: Ie796fb070a5bf0c6f11e796152c4a84280d40021 Signed-off-by: Kamal Negi <kamaln@codeaurora.org>
This commit is contained in:
parent
7c3d564c2b
commit
52f33ca808
|
@ -2217,10 +2217,6 @@ int hci_register_dev(struct hci_dev *hdev)
|
|||
|
||||
BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
|
||||
|
||||
write_lock(&hci_dev_list_lock);
|
||||
list_add(&hdev->list, &hci_dev_list);
|
||||
write_unlock(&hci_dev_list_lock);
|
||||
|
||||
hdev->workqueue = alloc_workqueue(hdev->name, WQ_HIGHPRI | WQ_UNBOUND |
|
||||
WQ_MEM_RECLAIM, 1);
|
||||
if (!hdev->workqueue) {
|
||||
|
@ -2259,6 +2255,10 @@ int hci_register_dev(struct hci_dev *hdev)
|
|||
if (hdev->dev_type != HCI_AMP)
|
||||
set_bit(HCI_AUTO_OFF, &hdev->dev_flags);
|
||||
|
||||
write_lock(&hci_dev_list_lock);
|
||||
list_add(&hdev->list, &hci_dev_list);
|
||||
write_unlock(&hci_dev_list_lock);
|
||||
|
||||
hci_notify(hdev, HCI_DEV_REG);
|
||||
hci_dev_hold(hdev);
|
||||
|
||||
|
|
Loading…
Reference in New Issue