• Johan Hedberg's avatar
    Bluetooth: Move identity address update behind a workqueue · f3d82d0c
    Johan Hedberg authored
    The identity address update of all channels for an l2cap_conn needs to
    take the lock for each channel, i.e. it's safest to do this by a
    separate workqueue callback.
    
    Previously this was partially solved by moving the entire SMP key
    distribution behind a workqueue. However, if we want SMP context locking
    to be correct and safe we should always use the l2cap_chan lock when
    accessing it, meaning even smp_distribute_keys needs to take that lock
    which would once again create a dead lock when updating the identity
    address.
    
    The simplest way to solve this is to have l2cap_conn manage the deferred
    work which is what this patch does. A subsequent patch will remove the
    now unnecessary SMP key distribution work struct.
    Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
    Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    f3d82d0c
smp.c 40.5 KB