* [PATCH] Bluetooth: A2MP: Do not reference hci_conn
@ 2012-05-31 8:01 Andrei Emeltchenko
2012-05-31 13:26 ` Gustavo Padovan
0 siblings, 1 reply; 2+ messages in thread
From: Andrei Emeltchenko @ 2012-05-31 8:01 UTC (permalink / raw)
To: linux-bluetooth, mathewm
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
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>
---
net/bluetooth/a2mp.c | 2 --
net/bluetooth/l2cap_core.c | 4 +++-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index e08ca2a..0772c68 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)
BT_DBG("chan %p", chan);
- hci_conn_hold(conn->hcon);
-
chan->chan_type = L2CAP_CHAN_CONN_FIX_A2MP;
chan->flush_to = L2CAP_DEFAULT_FLUSH_TO;
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 953ac53..bef5266 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)
l2cap_chan_put(chan);
chan->conn = NULL;
- hci_conn_put(conn->hcon);
+
+ if (chan->chan_type != L2CAP_CHAN_CONN_FIX_A2MP)
+ hci_conn_put(conn->hcon);
}
if (chan->ops->teardown)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: A2MP: Do not reference hci_conn
2012-05-31 8:01 [PATCH] Bluetooth: A2MP: Do not reference hci_conn Andrei Emeltchenko
@ 2012-05-31 13:26 ` Gustavo Padovan
0 siblings, 0 replies; 2+ messages in thread
From: Gustavo Padovan @ 2012-05-31 13:26 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth, mathewm
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-05-31 11:01:37 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> 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>
> ---
> net/bluetooth/a2mp.c | 2 --
> net/bluetooth/l2cap_core.c | 4 +++-
> 2 files changed, 3 insertions(+), 3 deletions(-)
Patch has been applied to bluetooth-next, thanks.
Gustavo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-31 13:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-31 8:01 [PATCH] Bluetooth: A2MP: Do not reference hci_conn Andrei Emeltchenko
2012-05-31 13:26 ` Gustavo Padovan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox