summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/bnep
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2011-07-24 06:11:07 +0200
committerGustavo F. Padovan <padovan@profusion.mobi>2011-08-12 00:50:26 +0200
commit38d57555616afcdad7381b02b523d494327494cd (patch)
tree7e1acedb545e0490f1a5cf366d3ab57c05ab910a /net/bluetooth/bnep
parentBluetooth: sco: Fix lost wakeups waiting to accept socket (diff)
downloadlinux-38d57555616afcdad7381b02b523d494327494cd.tar.xz
linux-38d57555616afcdad7381b02b523d494327494cd.zip
Bluetooth: bnep: 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/bnep')
-rw-r--r--net/bluetooth/bnep/core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index ca39fcf010ce..7e8ff3c24942 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -484,9 +484,11 @@ static int bnep_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;
/* RX */
while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
skb_orphan(skb);
@@ -504,7 +506,7 @@ static int bnep_session(void *arg)
schedule();
}
- set_current_state(TASK_RUNNING);
+ __set_current_state(TASK_RUNNING);
remove_wait_queue(sk_sleep(sk), &wait);
/* Cleanup session */