diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_conn.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index ca01d1861854..a7a27bc2c0b1 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -289,10 +289,20 @@ static void hci_conn_timeout(struct work_struct *work) | |||
289 | { | 289 | { |
290 | struct hci_conn *conn = container_of(work, struct hci_conn, | 290 | struct hci_conn *conn = container_of(work, struct hci_conn, |
291 | disc_work.work); | 291 | disc_work.work); |
292 | int refcnt = atomic_read(&conn->refcnt); | ||
292 | 293 | ||
293 | BT_DBG("hcon %p state %s", conn, state_to_string(conn->state)); | 294 | BT_DBG("hcon %p state %s", conn, state_to_string(conn->state)); |
294 | 295 | ||
295 | if (atomic_read(&conn->refcnt)) | 296 | WARN_ON(refcnt < 0); |
297 | |||
298 | /* FIXME: It was observed that in pairing failed scenario, refcnt | ||
299 | * drops below 0. Probably this is because l2cap_conn_del calls | ||
300 | * l2cap_chan_del for each channel, and inside l2cap_chan_del conn is | ||
301 | * dropped. After that loop hci_chan_del is called which also drops | ||
302 | * conn. For now make sure that ACL is alive if refcnt is higher then 0, | ||
303 | * otherwise drop it. | ||
304 | */ | ||
305 | if (refcnt > 0) | ||
296 | return; | 306 | return; |
297 | 307 | ||
298 | switch (conn->state) { | 308 | switch (conn->state) { |