diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 9832f8445d43..e121e0bea0cc 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1683,6 +1683,9 @@ int hci_get_auth_info(struct hci_dev *hdev, void __user *arg) struct hci_auth_info_req req; struct hci_conn *conn; + if ((!(&hdev->lock)) || (!hdev)) + return -EBADFD; + if (copy_from_user(&req, arg, sizeof(req))) return -EFAULT; diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 68bfe57b6625..24f343cca9c1 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3650,8 +3650,9 @@ EXPORT_SYMBOL(hci_alloc_dev); /* Free HCI device */ void hci_free_dev(struct hci_dev *hdev) { - /* will free via device release */ - put_device(&hdev->dev); + /* will free via device release if it exists*/ + if(&hdev->dev) + put_device(&hdev->dev); } EXPORT_SYMBOL(hci_free_dev);