Commit 38b7da09 authored by Dave Young's avatar Dave Young Committed by David S. Miller

[BLUETOOTH]: put_device before device_del fix

Because of workqueue delay, the put_device could be called before
device_del, so move it to del_conn.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com> 
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2072c228
...@@ -259,22 +259,14 @@ int hci_conn_del(struct hci_conn *conn) ...@@ -259,22 +259,14 @@ int hci_conn_del(struct hci_conn *conn)
} }
tasklet_disable(&hdev->tx_task); tasklet_disable(&hdev->tx_task);
hci_conn_del_sysfs(conn);
hci_conn_hash_del(hdev, conn); hci_conn_hash_del(hdev, conn);
if (hdev->notify) if (hdev->notify)
hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
tasklet_enable(&hdev->tx_task); tasklet_enable(&hdev->tx_task);
skb_queue_purge(&conn->data_q); skb_queue_purge(&conn->data_q);
hci_conn_del_sysfs(conn);
hci_dev_put(hdev); hci_dev_put(hdev);
/* will free via device release */
put_device(&conn->dev);
return 0; return 0;
} }
......
...@@ -320,6 +320,7 @@ static void del_conn(struct work_struct *work) ...@@ -320,6 +320,7 @@ static void del_conn(struct work_struct *work)
{ {
struct hci_conn *conn = container_of(work, struct hci_conn, work); struct hci_conn *conn = container_of(work, struct hci_conn, work);
device_del(&conn->dev); device_del(&conn->dev);
put_device(&conn->dev);
} }
void hci_conn_del_sysfs(struct hci_conn *conn) void hci_conn_del_sysfs(struct hci_conn *conn)
......
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