aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-05-31 04:01:37 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-04 23:34:14 -0400
commit3cabbfdad3150e0083a64c951701c970ef970c77 (patch)
tree06cac37ffdf14a90f19d1712418a1ef9d0ffce97
parentfd83e2c27c1bd8b0e9dc7596339c2411385f8b0c (diff)
Bluetooth: A2MP: Do not reference hci_conn
Make A2MP channel special channel which do not reference hci_conn. This prevents from keeping ACL connection open when all L2CAP channels got closed. hci_conn_hold and hci_conn_put are not reference counts on the hci_conn structure in the typical way. They are reference counts for the ACL. When you do the last hci_conn_put, the ACL is disconnected after a timeout. Reported-by: Mat Martineau <mathewm@codeaurora.org> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
-rw-r--r--net/bluetooth/a2mp.c2
-rw-r--r--net/bluetooth/l2cap_core.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index e08ca2ac31aa..0772c680abe6 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -481,8 +481,6 @@ static struct l2cap_chan *a2mp_chan_open(struct l2cap_conn *conn)
481 481
482 BT_DBG("chan %p", chan); 482 BT_DBG("chan %p", chan);
483 483
484 hci_conn_hold(conn->hcon);
485
486 chan->chan_type = L2CAP_CHAN_CONN_FIX_A2MP; 484 chan->chan_type = L2CAP_CHAN_CONN_FIX_A2MP;
487 chan->flush_to = L2CAP_DEFAULT_FLUSH_TO; 485 chan->flush_to = L2CAP_DEFAULT_FLUSH_TO;
488 486
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 953ac53ae438..bef5266563a6 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -514,7 +514,9 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
514 l2cap_chan_put(chan); 514 l2cap_chan_put(chan);
515 515
516 chan->conn = NULL; 516 chan->conn = NULL;
517 hci_conn_put(conn->hcon); 517
518 if (chan->chan_type != L2CAP_CHAN_CONN_FIX_A2MP)
519 hci_conn_put(conn->hcon);
518 } 520 }
519 521
520 if (chan->ops->teardown) 522 if (chan->ops->teardown)