diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_conn.c | 10 | ||||
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 1 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 22 |
3 files changed, 15 insertions, 18 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 9483320f6dad..34d1a3c822bf 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -259,22 +259,14 @@ int hci_conn_del(struct hci_conn *conn) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | tasklet_disable(&hdev->tx_task); | 261 | tasklet_disable(&hdev->tx_task); |
262 | |||
263 | hci_conn_del_sysfs(conn); | ||
264 | |||
265 | hci_conn_hash_del(hdev, conn); | 262 | hci_conn_hash_del(hdev, conn); |
266 | if (hdev->notify) | 263 | if (hdev->notify) |
267 | hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); | 264 | hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); |
268 | |||
269 | tasklet_enable(&hdev->tx_task); | 265 | tasklet_enable(&hdev->tx_task); |
270 | |||
271 | skb_queue_purge(&conn->data_q); | 266 | skb_queue_purge(&conn->data_q); |
272 | 267 | hci_conn_del_sysfs(conn); | |
273 | hci_dev_put(hdev); | 268 | hci_dev_put(hdev); |
274 | 269 | ||
275 | /* will free via device release */ | ||
276 | put_device(&conn->dev); | ||
277 | |||
278 | return 0; | 270 | return 0; |
279 | } | 271 | } |
280 | 272 | ||
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index cef1e3e1881c..cad510309dcf 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -320,6 +320,7 @@ static void del_conn(struct work_struct *work) | |||
320 | { | 320 | { |
321 | struct hci_conn *conn = container_of(work, struct hci_conn, work); | 321 | struct hci_conn *conn = container_of(work, struct hci_conn, work); |
322 | device_del(&conn->dev); | 322 | device_del(&conn->dev); |
323 | put_device(&conn->dev); | ||
323 | } | 324 | } |
324 | 325 | ||
325 | void hci_conn_del_sysfs(struct hci_conn *conn) | 326 | void hci_conn_del_sysfs(struct hci_conn *conn) |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index e447651a2dbe..a6a758dd1f7d 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -95,9 +95,10 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev) | |||
95 | 95 | ||
96 | BT_DBG("dev %p dlc %p", dev, dlc); | 96 | BT_DBG("dev %p dlc %p", dev, dlc); |
97 | 97 | ||
98 | write_lock_bh(&rfcomm_dev_lock); | 98 | /* Refcount should only hit zero when called from rfcomm_dev_del() |
99 | list_del_init(&dev->list); | 99 | which will have taken us off the list. Everything else are |
100 | write_unlock_bh(&rfcomm_dev_lock); | 100 | refcounting bugs. */ |
101 | BUG_ON(!list_empty(&dev->list)); | ||
101 | 102 | ||
102 | rfcomm_dlc_lock(dlc); | 103 | rfcomm_dlc_lock(dlc); |
103 | /* Detach DLC if it's owned by this dev */ | 104 | /* Detach DLC if it's owned by this dev */ |
@@ -109,11 +110,6 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev) | |||
109 | 110 | ||
110 | tty_unregister_device(rfcomm_tty_driver, dev->id); | 111 | tty_unregister_device(rfcomm_tty_driver, dev->id); |
111 | 112 | ||
112 | /* Refcount should only hit zero when called from rfcomm_dev_del() | ||
113 | which will have taken us off the list. Everything else are | ||
114 | refcounting bugs. */ | ||
115 | BUG_ON(!list_empty(&dev->list)); | ||
116 | |||
117 | kfree(dev); | 113 | kfree(dev); |
118 | 114 | ||
119 | /* It's safe to call module_put() here because socket still | 115 | /* It's safe to call module_put() here because socket still |
@@ -313,7 +309,15 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev) | |||
313 | { | 309 | { |
314 | BT_DBG("dev %p", dev); | 310 | BT_DBG("dev %p", dev); |
315 | 311 | ||
316 | set_bit(RFCOMM_TTY_RELEASED, &dev->flags); | 312 | if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) |
313 | BUG_ON(1); | ||
314 | else | ||
315 | set_bit(RFCOMM_TTY_RELEASED, &dev->flags); | ||
316 | |||
317 | write_lock_bh(&rfcomm_dev_lock); | ||
318 | list_del_init(&dev->list); | ||
319 | write_unlock_bh(&rfcomm_dev_lock); | ||
320 | |||
317 | rfcomm_dev_put(dev); | 321 | rfcomm_dev_put(dev); |
318 | } | 322 | } |
319 | 323 | ||