Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46e06531 authored by David Herrmann's avatar David Herrmann Committed by Johan Hedberg
Browse files

Bluetooth: Correctly acquire module ref



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: default avatarDavid Herrmann <dh.herrmann@googlemail.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 587ae086
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -372,6 +372,7 @@ static void bt_host_release(struct device *dev)
{
{
	void *data = dev_get_drvdata(dev);
	void *data = dev_get_drvdata(dev);
	kfree(data);
	kfree(data);
	module_put(THIS_MODULE);
}
}


static struct device_type bt_host = {
static struct device_type bt_host = {
@@ -523,6 +524,7 @@ void hci_init_sysfs(struct hci_dev *hdev)
	dev->type = &bt_host;
	dev->type = &bt_host;
	dev->class = bt_class;
	dev->class = bt_class;


	__module_get(THIS_MODULE);
	dev_set_drvdata(dev, hdev);
	dev_set_drvdata(dev, hdev);
	device_initialize(dev);
	device_initialize(dev);
}
}