]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Bluetooth: Correctly acquire module ref
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 7 Jan 2012 14:47:21 +0000 (15:47 +0100)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 13 Feb 2012 15:01:24 +0000 (17:01 +0200)
We provide a device-object to other subsystems and we provide our own
release-function. Therefore, the device-object must own a reference to
our module, otherwise the release-function may get deleted before the
device-object does.

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>
net/bluetooth/hci_sysfs.c

index 74b49e330a1d5ba7e69a3901cbee223eeb76e033..ec03ee2b301e2c674df8b3b342c7e448fb0b7acf 100644 (file)
@@ -372,6 +372,7 @@ static void bt_host_release(struct device *dev)
 {
        void *data = dev_get_drvdata(dev);
        kfree(data);
+       module_put(THIS_MODULE);
 }
 
 static struct device_type bt_host = {
@@ -523,6 +524,7 @@ void hci_init_sysfs(struct hci_dev *hdev)
        dev->type = &bt_host;
        dev->class = bt_class;
 
+       __module_get(THIS_MODULE);
        dev_set_drvdata(dev, hdev);
        device_initialize(dev);
 }