Commit 2e58ef3e authored by Johan Hedberg's avatar Johan Hedberg Committed by Gustavo F. Padovan

Bluetooth: Move pending management command list into struct hci_dev

This patch moves the pending management command list (previously global
to mgmt.c) into struct hci_dev. This makes it possible to do proper
locking when accessing it (through the existing hci_dev locks) and
thereby avoid race conditions.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 744cf19e
...@@ -217,6 +217,8 @@ struct hci_dev { ...@@ -217,6 +217,8 @@ struct hci_dev {
__u16 init_last_cmd; __u16 init_last_cmd;
struct list_head mgmt_pending;
struct inquiry_cache inq_cache; struct inquiry_cache inq_cache;
struct hci_conn_hash conn_hash; struct hci_conn_hash conn_hash;
struct list_head blacklist; struct list_head blacklist;
......
...@@ -1481,6 +1481,8 @@ int hci_register_dev(struct hci_dev *hdev) ...@@ -1481,6 +1481,8 @@ int hci_register_dev(struct hci_dev *hdev)
hci_conn_hash_init(hdev); hci_conn_hash_init(hdev);
INIT_LIST_HEAD(&hdev->mgmt_pending);
INIT_LIST_HEAD(&hdev->blacklist); INIT_LIST_HEAD(&hdev->blacklist);
INIT_LIST_HEAD(&hdev->uuids); INIT_LIST_HEAD(&hdev->uuids);
...@@ -1562,6 +1564,10 @@ void hci_unregister_dev(struct hci_dev *hdev) ...@@ -1562,6 +1564,10 @@ void hci_unregister_dev(struct hci_dev *hdev)
!test_bit(HCI_SETUP, &hdev->flags)) !test_bit(HCI_SETUP, &hdev->flags))
mgmt_index_removed(hdev); mgmt_index_removed(hdev);
/* mgmt_index_removed should take care of emptying the
* pending list */
BUG_ON(!list_empty(&hdev->mgmt_pending));
hci_notify(hdev, HCI_DEV_UNREG); hci_notify(hdev, HCI_DEV_UNREG);
if (hdev->rfkill) { if (hdev->rfkill) {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment