aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2007-04-26 04:41:01 -0400
committerDavid S. Miller <davem@davemloft.net>2007-04-26 04:41:01 -0400
commit74da9d88bf5ffd31aed61a0b19519684ad744ded (patch)
tree601509eaf04f387578ddc72015c0d7c62709e72a /net
parent9198d2220d29b87ac3a05a3b791c50bb8a014d63 (diff)
[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>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/rfcomm/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 10cc13cfae6c..fe7df90eb707 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -1851,18 +1851,18 @@ static void rfcomm_worker(void)
1851 BT_DBG(""); 1851 BT_DBG("");
1852 1852
1853 while (!atomic_read(&terminate)) { 1853 while (!atomic_read(&terminate)) {
1854 set_current_state(TASK_INTERRUPTIBLE);
1854 if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) { 1855 if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
1855 /* No pending events. Let's sleep. 1856 /* No pending events. Let's sleep.
1856 * Incoming connections and data will wake us up. */ 1857 * Incoming connections and data will wake us up. */
1857 set_current_state(TASK_INTERRUPTIBLE);
1858 schedule(); 1858 schedule();
1859 } 1859 }
1860 set_current_state(TASK_RUNNING);
1860 1861
1861 /* Process stuff */ 1862 /* Process stuff */
1862 clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event); 1863 clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
1863 rfcomm_process_sessions(); 1864 rfcomm_process_sessions();
1864 } 1865 }
1865 set_current_state(TASK_RUNNING);
1866 return; 1866 return;
1867} 1867}
1868 1868