• Johan Hedberg's avatar
    Bluetooth: Always call smp_distribute_keys() from a workqueue · 86d1407c
    Johan Hedberg authored
    The smp_distribute_keys() function calls smp_notify_keys() which in turn
    calls l2cap_conn_update_id_addr(). The l2cap_conn_update_id_addr()
    function will iterate through all L2CAP channels for the respective
    connection: lock the channel, update the address information and unlock
    the channel.
    
    Since SMP is now using l2cap_chan callbacks each callback is called with
    the channel lock held. Therefore, calling l2cap_conn_update_id_addr()
    would cause a deadlock calling l2cap_chan_lock() on the SMP channel.
    This patch moves calling smp_distribute_keys() through a workqueue so
    that it is never called from an L2CAP channel callback.
    Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
    Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    86d1407c
smp.c 40.6 KB