Bluetooth: L2CAP: Only call disconnected callback for connected channels
If channel has conn set to NULL disconnected shall not be called as may cause invalid actions as with bt_gatt_disconnected being called with a NULL conn. Change-Id: I11bc41a34c2a2a3bc5f8514ec4a948235473cfba Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
2dda2a9835
commit
96b9425a64
1 changed files with 6 additions and 1 deletions
|
@ -194,12 +194,17 @@ static void l2cap_chan_del(struct bt_l2cap_chan *chan)
|
||||||
{
|
{
|
||||||
BT_DBG("conn %p chan %p", chan->conn, chan);
|
BT_DBG("conn %p chan %p", chan->conn, chan);
|
||||||
|
|
||||||
chan->conn = NULL;
|
if (!chan->conn) {
|
||||||
|
goto destroy;
|
||||||
|
}
|
||||||
|
|
||||||
if (chan->ops && chan->ops->disconnected) {
|
if (chan->ops && chan->ops->disconnected) {
|
||||||
chan->ops->disconnected(chan);
|
chan->ops->disconnected(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chan->conn = NULL;
|
||||||
|
|
||||||
|
destroy:
|
||||||
if (chan->destroy) {
|
if (chan->destroy) {
|
||||||
chan->destroy(chan);
|
chan->destroy(chan);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue