From: Andrew Morton Date: Thu, 26 Apr 2007 08:41:01 +0000 (-0700) Subject: [BLUETOOTH] rfcomm_worker(): fix wakeup race X-Git-Tag: v2.6.22-rc1~1128^2~34 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74da9d88bf5ffd31aed61a0b19519684ad744ded;p=linux-2.6 [BLUETOOTH] rfcomm_worker(): fix wakeup race Set TASK_INTERRUPTIBLE prior to testing the flag to avoid missed wakeups. Signed-off-by: Andrew Morton Acked-by: Marcel Holtmann Signed-off-by: David S. Miller --- diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 10cc13cfae..fe7df90eb7 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -1851,18 +1851,18 @@ static void rfcomm_worker(void) BT_DBG(""); while (!atomic_read(&terminate)) { + set_current_state(TASK_INTERRUPTIBLE); if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) { /* No pending events. Let's sleep. * Incoming connections and data will wake us up. */ - set_current_state(TASK_INTERRUPTIBLE); schedule(); } + set_current_state(TASK_RUNNING); /* Process stuff */ clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event); rfcomm_process_sessions(); } - set_current_state(TASK_RUNNING); return; }