diff options
Diffstat (limited to 'net/bluetooth/l2cap_core.c')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 777c41dbfdbe..a6559225bb50 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -546,7 +546,10 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan) | |||
546 | 546 | ||
547 | l2cap_chan_hold(chan); | 547 | l2cap_chan_hold(chan); |
548 | 548 | ||
549 | hci_conn_hold(conn->hcon); | 549 | /* Only keep a reference for fixed channels if they requested it */ |
550 | if (chan->chan_type != L2CAP_CHAN_FIXED || | ||
551 | test_bit(FLAG_HOLD_HCI_CONN, &chan->flags)) | ||
552 | hci_conn_hold(conn->hcon); | ||
550 | 553 | ||
551 | list_add(&chan->list, &conn->chan_l); | 554 | list_add(&chan->list, &conn->chan_l); |
552 | } | 555 | } |
@@ -577,7 +580,12 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err) | |||
577 | 580 | ||
578 | chan->conn = NULL; | 581 | chan->conn = NULL; |
579 | 582 | ||
580 | if (chan->scid != L2CAP_CID_A2MP) | 583 | /* Reference was only held for non-fixed channels or |
584 | * fixed channels that explicitly requested it using the | ||
585 | * FLAG_HOLD_HCI_CONN flag. | ||
586 | */ | ||
587 | if (chan->chan_type != L2CAP_CHAN_FIXED || | ||
588 | test_bit(FLAG_HOLD_HCI_CONN, &chan->flags)) | ||
581 | hci_conn_drop(conn->hcon); | 589 | hci_conn_drop(conn->hcon); |
582 | 590 | ||
583 | if (mgr && mgr->bredr_chan == chan) | 591 | if (mgr && mgr->bredr_chan == chan) |