Bluetooth: Always call smp_distribute_keys() from a workqueue
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 11 Aug 2014 19:06:43 +0000 (22:06 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 14 Aug 2014 06:49:24 +0000 (08:49 +0200)
commit86d1407cb9cd3cb866eae24a2aedb8006160db69
tree618bfad9cc5409c0833c53eda0a64921c3f08243
parent109ec2309eb996fbe03302fbd40dec9014c6f849
Bluetooth: Always call smp_distribute_keys() from a workqueue

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: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/smp.c