Commit 7c4efa69 authored by Maksim Krasnyanskiy's avatar Maksim Krasnyanskiy

[Bluetooth] Fix race condition in RFCOMM session and dcl scheduler.

This fixes random RFCOMM freezes reported by some people.
parent 46acabae
......@@ -220,10 +220,9 @@ static inline void rfcomm_schedule(uint event)
{
if (!rfcomm_thread)
return;
//set_bit(event, &rfcomm_event);
if (!test_and_set_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event))
wake_up_process(rfcomm_thread);
set_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
wake_up_process(rfcomm_thread);
}
extern struct semaphore rfcomm_sem;
......
......@@ -1483,9 +1483,9 @@ static inline int rfcomm_process_tx(struct rfcomm_dlc *d)
d->rx_credits = d->credits;
}
} else {
/* CFC disabled.
/* CFC disabled.
* Give ourselves some credits */
d->tx_credits = RFCOMM_MAX_CREDITS;
d->tx_credits = 5;
}
if (test_bit(RFCOMM_TX_THROTTLED, &d->flags))
......@@ -1651,7 +1651,7 @@ static void rfcomm_worker(void)
BT_DBG("");
while (!atomic_read(&terminate)) {
if (!test_and_clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
/* No pending events. Let's sleep.
* Incomming connections and data will wake us up. */
set_current_state(TASK_INTERRUPTIBLE);
......@@ -1659,6 +1659,7 @@ static void rfcomm_worker(void)
}
/* Process stuff */
clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
rfcomm_process_sessions();
}
set_current_state(TASK_RUNNING);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment