summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2011-07-24 00:11:07 -0400
committerJonas ABERG <jonas.aberg@stericsson.com>2011-10-28 11:01:28 +0200
commitd0c4090bbbb550c03528e0f7d10f29da73e96ba9 (patch)
tree517cb9ca0535a4481d7cd1189266545c45ff7d09 /net
parente20918b6f1d0737a5d6d7ff55eb7378e1a48030d (diff)
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> Change-Id: I7047dfb72066d726d04f6ca97f2fada70339fdaa Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/35568 Tested-by: Per VAHLNE <per.xx.vahlne@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'net')
-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 7f4d008f4e9..e1c5c1b13d3 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -519,9 +519,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);
@@ -539,7 +541,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 */