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 18:50:27 -0400 |
commit | 3a3f5c7df55a1294c9e6e2d0b8cea604b137438f (patch) | |
tree | cd08e954cf3c7ea036f597a96a72ebc56f0f5218 /net | |
parent | 38d57555616afcdad7381b02b523d494327494cd (diff) |
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')
-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) | |||
292 | 292 | ||
293 | init_waitqueue_entry(&wait, current); | 293 | init_waitqueue_entry(&wait, current); |
294 | add_wait_queue(sk_sleep(sk), &wait); | 294 | add_wait_queue(sk_sleep(sk), &wait); |
295 | while (!kthread_should_stop()) { | 295 | while (1) { |
296 | set_current_state(TASK_INTERRUPTIBLE); | 296 | set_current_state(TASK_INTERRUPTIBLE); |
297 | 297 | ||
298 | if (kthread_should_stop()) | ||
299 | break; | ||
298 | if (sk->sk_state != BT_CONNECTED) | 300 | if (sk->sk_state != BT_CONNECTED) |
299 | break; | 301 | break; |
300 | 302 | ||
@@ -307,7 +309,7 @@ static int cmtp_session(void *arg) | |||
307 | 309 | ||
308 | schedule(); | 310 | schedule(); |
309 | } | 311 | } |
310 | set_current_state(TASK_RUNNING); | 312 | __set_current_state(TASK_RUNNING); |
311 | remove_wait_queue(sk_sleep(sk), &wait); | 313 | remove_wait_queue(sk_sleep(sk), &wait); |
312 | 314 | ||
313 | down_write(&cmtp_session_sem); | 315 | down_write(&cmtp_session_sem); |