diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2011-07-24 00:11:10 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-08-11 19:50:27 -0300 |
commit | 3a3f5c7df55a1294c9e6e2d0b8cea604b137438f (patch) | |
tree | cd08e954cf3c7ea036f597a96a72ebc56f0f5218 /net/bluetooth/cmtp | |
parent | 38d57555616afcdad7381b02b523d494327494cd (diff) | |
download | linux-3a3f5c7df55a1294c9e6e2d0b8cea604b137438f.tar.gz linux-3a3f5c7df55a1294c9e6e2d0b8cea604b137438f.tar.bz2 linux-3a3f5c7df55a1294c9e6e2d0b8cea604b137438f.zip |
Bluetooth: cmtp: Fix lost wakeup of session thread
Fix race condition which can result in missing the wakeup intended
to stop the session thread.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/cmtp')
-rw-r--r-- | net/bluetooth/cmtp/core.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index c5b11af908be..2eb854ab10f6 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -292,9 +292,11 @@ static int cmtp_session(void *arg) init_waitqueue_entry(&wait, current); add_wait_queue(sk_sleep(sk), &wait); - while (!kthread_should_stop()) { + while (1) { set_current_state(TASK_INTERRUPTIBLE); + if (kthread_should_stop()) + break; if (sk->sk_state != BT_CONNECTED) break; @@ -307,7 +309,7 @@ static int cmtp_session(void *arg) schedule(); } - set_current_state(TASK_RUNNING); + __set_current_state(TASK_RUNNING); remove_wait_queue(sk_sleep(sk), &wait); down_write(&cmtp_session_sem); |