提交 74da9d88 编写于 作者: A Andrew Morton 提交者: David S. Miller

[BLUETOOTH] rfcomm_worker(): fix wakeup race

Set TASK_INTERRUPTIBLE prior to testing the flag to avoid missed wakeups.
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Acked-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9198d222
...@@ -1851,18 +1851,18 @@ static void rfcomm_worker(void) ...@@ -1851,18 +1851,18 @@ static void rfcomm_worker(void)
BT_DBG(""); BT_DBG("");
while (!atomic_read(&terminate)) { while (!atomic_read(&terminate)) {
set_current_state(TASK_INTERRUPTIBLE);
if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) { if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
/* No pending events. Let's sleep. /* No pending events. Let's sleep.
* Incoming connections and data will wake us up. */ * Incoming connections and data will wake us up. */
set_current_state(TASK_INTERRUPTIBLE);
schedule(); schedule();
} }
set_current_state(TASK_RUNNING);
/* Process stuff */ /* Process stuff */
clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event); clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
rfcomm_process_sessions(); rfcomm_process_sessions();
} }
set_current_state(TASK_RUNNING);
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册