Skip to content

Commit 74da9d8

Browse files
akpm00davem330
authored andcommitted
[BLUETOOTH] rfcomm_worker(): fix wakeup race
Set TASK_INTERRUPTIBLE prior to testing the flag to avoid missed wakeups. Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9198d22 commit 74da9d8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/bluetooth/rfcomm/core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,18 +1851,18 @@ static void rfcomm_worker(void)
18511851
BT_DBG("");
18521852

18531853
while (!atomic_read(&terminate)) {
1854+
set_current_state(TASK_INTERRUPTIBLE);
18541855
if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
18551856
/* No pending events. Let's sleep.
18561857
* Incoming connections and data will wake us up. */
1857-
set_current_state(TASK_INTERRUPTIBLE);
18581858
schedule();
18591859
}
1860+
set_current_state(TASK_RUNNING);
18601861

18611862
/* Process stuff */
18621863
clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
18631864
rfcomm_process_sessions();
18641865
}
1865-
set_current_state(TASK_RUNNING);
18661866
return;
18671867
}
18681868

0 commit comments

Comments
 (0)