]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
Bluetooth: Fix canceling RPA expiry timer
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 24 Feb 2014 18:35:07 +0000 (20:35 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 24 Feb 2014 19:05:26 +0000 (11:05 -0800)
The RPA expiry timer is only initialized inside mgmt.c when we receive
the first command from user space. This action also involves setting the
HCI_MGMT flag for the first time so that flag acts as a good indicator
of whether the delayed work variable can be touched or not. This patch
fixes hci_dev_do_close to first check the flag.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_core.c

index 4bb4f4e7bbbe938ea5cf0923b1a8bde23f74d69d..669c76ec659a7daa440616b2f1bee378072d5ad8 100644 (file)
@@ -2257,7 +2257,9 @@ static int hci_dev_do_close(struct hci_dev *hdev)
                cancel_delayed_work(&hdev->service_cache);
 
        cancel_delayed_work_sync(&hdev->le_scan_disable);
-       cancel_delayed_work_sync(&hdev->rpa_expired);
+
+       if (test_bit(HCI_MGMT, &hdev->dev_flags))
+               cancel_delayed_work_sync(&hdev->rpa_expired);
 
        hci_dev_lock(hdev);
        hci_inquiry_cache_flush(hdev);