提交 bcbb655a 编写于 作者: J Johan Hedberg 提交者: Marcel Holtmann

Bluetooth: Remove hci_conn_hold/drop from hci_chan

We can't have hci_chan contribute to the "active" reference counting of
the hci_conn since otherwise the connection would never get dropped when
there are no more users (since hci_chan would be counted as a user).
This patch removes hold() when creating the hci_chan and drop() when
destroying it.
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 f94b665d
...@@ -1301,7 +1301,6 @@ struct hci_chan *hci_chan_create(struct hci_conn *conn) ...@@ -1301,7 +1301,6 @@ struct hci_chan *hci_chan_create(struct hci_conn *conn)
return NULL; return NULL;
chan->conn = hci_conn_get(conn); chan->conn = hci_conn_get(conn);
hci_conn_hold(conn);
skb_queue_head_init(&chan->data_q); skb_queue_head_init(&chan->data_q);
chan->state = BT_CONNECTED; chan->state = BT_CONNECTED;
...@@ -1321,11 +1320,9 @@ void hci_chan_del(struct hci_chan *chan) ...@@ -1321,11 +1320,9 @@ void hci_chan_del(struct hci_chan *chan)
synchronize_rcu(); synchronize_rcu();
/* Force the connection to be immediately dropped */ /* Prevent new hci_chan's to be created for this hci_conn */
conn->disc_timeout = 0;
set_bit(HCI_CONN_DROP, &conn->flags); set_bit(HCI_CONN_DROP, &conn->flags);
hci_conn_drop(conn);
hci_conn_put(conn); hci_conn_put(conn);
skb_queue_purge(&chan->data_q); skb_queue_purge(&chan->data_q);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册