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,9 +220,8 @@ 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))
set_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
wake_up_process(rfcomm_thread);
}
......
......@@ -1485,7 +1485,7 @@ static inline int rfcomm_process_tx(struct rfcomm_dlc *d)
} else {
/* 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