• Johan Hedberg's avatar
    Bluetooth: Fix hci_conn reference counting for fixed channels · c16900cf
    Johan Hedberg authored
    Now that SMP has been converted to use fixed channels we've got a bit of
    a problem with the hci_conn reference counting. So far the L2CAP code
    has kept a reference for each L2CAP channel that was notified of the
    connection. With SMP however this would mean that the connection is
    never dropped even though there are no other users of it. Furthermore,
    SMP already does its own hci_conn reference counting internally,
    starting from a security or pairing request and ending with the key
    distribution.
    
    This patch makes L2CAP fixed channels default to the L2CAP core not
    keeping a hci_conn reference for them. A new FLAG_HOLD_HCI_CONN flag is
    added so that L2CAP users can declare an exception to this rule and hold
    a reference even for their fixed channels. One such exception is the
    L2CAP socket layer which does want a reference for each socket (e.g. an
    ATT socket which uses a fixed channel).
    Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
    Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    c16900cf
l2cap_sock.c 34.5 KB