Skip to content

Commit

Permalink
bluetooth: put hci dev after del conn
Browse files Browse the repository at this point in the history
Move hci_dev_put to del_conn to avoid hci dev going away before hci conn.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dave Young authored and David S. Miller committed Feb 19, 2008
1 parent 8f789c4 commit 0cd63c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ int hci_conn_del(struct hci_conn *conn)
tasklet_enable(&hdev->tx_task);
skb_queue_purge(&conn->data_q);
hci_conn_del_sysfs(conn);
hci_dev_put(hdev);

return 0;
}
Expand Down
3 changes: 3 additions & 0 deletions net/bluetooth/hci_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ static int __match_tty(struct device *dev, void *data)
static void del_conn(struct work_struct *work)
{
struct hci_conn *conn = container_of(work, struct hci_conn, work);
struct hci_dev *hdev = conn->hdev;

while (1) {
struct device *dev;
Expand All @@ -344,8 +345,10 @@ static void del_conn(struct work_struct *work)
device_move(dev, NULL);
put_device(dev);
}

device_del(&conn->dev);
put_device(&conn->dev);
hci_dev_put(hdev);
}

void hci_conn_del_sysfs(struct hci_conn *conn)
Expand Down

0 comments on commit 0cd63c8

Please sign in to comment.