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>
This commit is contained in:
parent
552b0d3cb9
commit
38d5755561
|
@ -484,9 +484,11 @@ static int bnep_session(void *arg)
|
||||||
|
|
||||||
init_waitqueue_entry(&wait, current);
|
init_waitqueue_entry(&wait, current);
|
||||||
add_wait_queue(sk_sleep(sk), &wait);
|
add_wait_queue(sk_sleep(sk), &wait);
|
||||||
while (!kthread_should_stop()) {
|
while (1) {
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
|
|
||||||
|
if (kthread_should_stop())
|
||||||
|
break;
|
||||||
/* RX */
|
/* RX */
|
||||||
while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
|
while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
|
||||||
skb_orphan(skb);
|
skb_orphan(skb);
|
||||||
|
@ -504,7 +506,7 @@ static int bnep_session(void *arg)
|
||||||
|
|
||||||
schedule();
|
schedule();
|
||||||
}
|
}
|
||||||
set_current_state(TASK_RUNNING);
|
__set_current_state(TASK_RUNNING);
|
||||||
remove_wait_queue(sk_sleep(sk), &wait);
|
remove_wait_queue(sk_sleep(sk), &wait);
|
||||||
|
|
||||||
/* Cleanup session */
|
/* Cleanup session */
|
||||||
|
|
Loading…
Reference in New Issue