aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Young <hidave.darkstar@gmail.com>2008-02-18 23:44:01 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-18 23:44:01 -0500
commit0cd63c8089f0f6316df1393c3a93bdbc67ab314d (patch)
treec1ce4d8c32439af25bd45cb95376258b429f576a
parent8f789c48448aed74fe1c07af76de8f04adacec7d (diff)
bluetooth: put hci dev after del conn
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>
-rw-r--r--net/bluetooth/hci_conn.c1
-rw-r--r--net/bluetooth/hci_sysfs.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 5fc7be206f62..f8880261da0e 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -260,7 +260,6 @@ int hci_conn_del(struct hci_conn *conn)
260 tasklet_enable(&hdev->tx_task); 260 tasklet_enable(&hdev->tx_task);
261 skb_queue_purge(&conn->data_q); 261 skb_queue_purge(&conn->data_q);
262 hci_conn_del_sysfs(conn); 262 hci_conn_del_sysfs(conn);
263 hci_dev_put(hdev);
264 263
265 return 0; 264 return 0;
266} 265}
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index f5aff6d0988a..767756c8fbcf 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -334,6 +334,7 @@ static int __match_tty(struct device *dev, void *data)
334static void del_conn(struct work_struct *work) 334static void del_conn(struct work_struct *work)
335{ 335{
336 struct hci_conn *conn = container_of(work, struct hci_conn, work); 336 struct hci_conn *conn = container_of(work, struct hci_conn, work);
337 struct hci_dev *hdev = conn->hdev;
337 338
338 while (1) { 339 while (1) {
339 struct device *dev; 340 struct device *dev;
@@ -344,8 +345,10 @@ static void del_conn(struct work_struct *work)
344 device_move(dev, NULL); 345 device_move(dev, NULL);
345 put_device(dev); 346 put_device(dev);
346 } 347 }
348
347 device_del(&conn->dev); 349 device_del(&conn->dev);
348 put_device(&conn->dev); 350 put_device(&conn->dev);
351 hci_dev_put(hdev);
349} 352}
350 353
351void hci_conn_del_sysfs(struct hci_conn *conn) 354void hci_conn_del_sysfs(struct hci_conn *conn)