浏览代码

Bluetooth: Reorder HCI user channel socket release

The hci close method needs to know if we are in user channel context.
Only add the index to mgmt once close is performed.

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Loic Poulain 10 年之前
父节点
当前提交
9380f9eacf
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      net/bluetooth/hci_sock.c

+ 2 - 2
net/bluetooth/hci_sock.c

@@ -503,9 +503,9 @@ static int hci_sock_release(struct socket *sock)
 
 
 	if (hdev) {
 	if (hdev) {
 		if (hci_pi(sk)->channel == HCI_CHANNEL_USER) {
 		if (hci_pi(sk)->channel == HCI_CHANNEL_USER) {
-			mgmt_index_added(hdev);
-			hci_dev_clear_flag(hdev, HCI_USER_CHANNEL);
 			hci_dev_close(hdev->id);
 			hci_dev_close(hdev->id);
+			hci_dev_clear_flag(hdev, HCI_USER_CHANNEL);
+			mgmt_index_added(hdev);
 		}
 		}
 
 
 		atomic_dec(&hdev->promisc);
 		atomic_dec(&hdev->promisc);