• Johan Hedberg's avatar
    Bluetooth: Fix reference counting for LE-scan based connections · b958f9a3
    Johan Hedberg authored
    The code should never directly call hci_conn_hash_del since many
    cleanup & reference counting updates would be lost. Normally
    hci_conn_del is the right thing to do, but in the case of a connection
    doing LE scanning this could cause a deadlock due to doing a
    cancel_delayed_work_sync() on the same work callback that we were
    called from.
    
    Connections in the LE scanning state actually need very little cleanup
    - just a small subset of hci_conn_del. To solve the issue, refactor
    out these essential pieces into a new hci_conn_cleanup() function and
    call that from the two necessary places.
    Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
    Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    b958f9a3
hci_conn.c 40 KB