diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2011-07-24 00:10:46 -0400 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2011-08-02 15:10:08 -0700 |
commit | f0ec22eebf93341763356aefb64f7e2100a70fdb (patch) | |
tree | 756aaa27c0e65f780d6e6d5d03b540c54eeda557 /net | |
parent | e7a40bf27d18c354efde02a9c9fd98669c21852b (diff) | |
download | kernel_samsung_espresso10-f0ec22eebf93341763356aefb64f7e2100a70fdb.zip kernel_samsung_espresso10-f0ec22eebf93341763356aefb64f7e2100a70fdb.tar.gz kernel_samsung_espresso10-f0ec22eebf93341763356aefb64f7e2100a70fdb.tar.bz2 |
Bluetooth: Fix lost wakeups waiting for sock state change
Fix race conditions which can cause lost wakeups while waiting
for sock state to change.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/af_bluetooth.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index e87d15d..7c73a10 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -532,9 +532,8 @@ int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo) BT_DBG("sk %p", sk); add_wait_queue(sk_sleep(sk), &wait); + set_current_state(TASK_INTERRUPTIBLE); while (sk->sk_state != state) { - set_current_state(TASK_INTERRUPTIBLE); - if (!timeo) { err = -EINPROGRESS; break; @@ -548,12 +547,13 @@ int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo) release_sock(sk); timeo = schedule_timeout(timeo); lock_sock(sk); + set_current_state(TASK_INTERRUPTIBLE); err = sock_error(sk); if (err) break; } - set_current_state(TASK_RUNNING); + __set_current_state(TASK_RUNNING); remove_wait_queue(sk_sleep(sk), &wait); return err; } |