diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2015-01-23 12:16:53 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2015-01-23 20:29:42 +0200 |
commit | dfb2fae7cd0a1aa13610b11d54203bcd3893da07 (patch) | |
tree | 3aa293285c349233441ae31661c72773992e603e /drivers/iommu | |
parent | a1443f5a273713d4bfda360e45aa6e1d14fe7324 (diff) | |
download | op-kernel-dev-dfb2fae7cd0a1aa13610b11d54203bcd3893da07.zip op-kernel-dev-dfb2fae7cd0a1aa13610b11d54203bcd3893da07.tar.gz |
Bluetooth: Fix nested sleeps
l2cap/rfcomm/sco_sock_accept() are wait loops which may acquire
sleeping locks. Since both wait loops and sleeping locks use
task_struct.state to sleep and wake, the nested sleeping locks
destroy the wait loop state.
Use the newly-minted wait_woken() and DEFINE_WAIT_FUNC() for the
wait loop. DEFINE_WAIT_FUNC() allows an alternate wake function
to be specified; in this case, the predefined scheduler function,
woken_wake_function(). This wait construct ensures wakeups will
not be missed without requiring the wait loop to set the
task state before condition evaluation. How this works:
CPU 0 | CPU 1
|
| is <condition> set?
| no
set <condition> |
|
wake_up_interruptible |
woken_wake_function |
set WQ_FLAG_WOKEN |
try_to_wake_up |
| wait_woken
| set TASK_INTERRUPTIBLE
| WQ_FLAG_WOKEN? yes
| set TASK_RUNNING
|
| - loop -
|
| is <condition> set?
| yes - exit wait loop
Fixes "do not call blocking ops when !TASK_RUNNING" warnings
in l2cap_sock_accept(), rfcomm_sock_accept() and sco_sock_accept().
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/iommu')
0 files changed, 0 insertions, 0 deletions