summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-01-07 15:47:23 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 17:01:24 +0200
commit4c724c7135ca2b407bd318b4267456a7b5723825 (patch)
tree978671b8806e87a4ec4b366b453be5ae9e9a7408 /net/bluetooth/hci_core.c
parente9b9cfa1575e37cb2dbb5534aeaaa16814228887 (diff)
downloadlinux-stable-4c724c7135ca2b407bd318b4267456a7b5723825.tar.gz
linux-stable-4c724c7135ca2b407bd318b4267456a7b5723825.tar.bz2
linux-stable-4c724c7135ca2b407bd318b4267456a7b5723825.zip
Bluetooth: Correctly take hci_dev->dev refcount
The hci_dev->dev device structure has an internal refcount. This refcount is used to protect the whole hci_dev object. However, we currently do not use it. Therefore, if someone calls hci_free_dev() we currently immediately destroy the hci_dev object because we never took the device refcount. This even happens if the hci_dev->refcnt is not 0. In fact, the hci_dev->refcnt is totally useless in its current state. Therefore, we simply remove hci_dev->refcnt and instead use hci_dev->dev refcnt. This fixes all the symptoms and also correctly integrates the device structure into our bluetooth bus system. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 58392a6b48b5..f5fba65a9e59 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1571,7 +1571,6 @@ int hci_register_dev(struct hci_dev *hdev)
hdev->id = id;
list_add_tail(&hdev->list, head);
- atomic_set(&hdev->refcnt, 1);
mutex_init(&hdev->lock);
hdev->flags = 0;
@@ -1655,6 +1654,7 @@ int hci_register_dev(struct hci_dev *hdev)
schedule_work(&hdev->power_on);
hci_notify(hdev, HCI_DEV_REG);
+ __hci_dev_hold(hdev);
return id;