[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-24
Subject:    [Bluetooth] Fix race condition in RFCOMM session and dlc scheduler.
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2003-04-26 16:37:28
[Download RAW message or body]

ChangeSet 1.1126.2.3, 2003/04/26 09:37:28-07:00, maxk@qualcomm.com

	[Bluetooth] Fix race condition in RFCOMM session and dlc scheduler.
	This fixes random RFCOMM freezes reported by a few people.


# This patch includes the following deltas:
#	           ChangeSet	1.1126.2.2 -> 1.1126.2.3
#	include/net/bluetooth/rfcomm.h	1.2     -> 1.3    
#	net/bluetooth/rfcomm/core.c	1.4     -> 1.5    
#

 include/net/bluetooth/rfcomm.h |    5 ++---
 net/bluetooth/rfcomm/core.c    |    9 ++++++---
 2 files changed, 8 insertions(+), 6 deletions(-)


diff -Nru a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
--- a/include/net/bluetooth/rfcomm.h	Mon Apr 28 17:05:27 2003
+++ b/include/net/bluetooth/rfcomm.h	Mon Apr 28 17:05:27 2003
@@ -220,9 +220,8 @@
 {
 	if (!rfcomm_thread)
 		return;
-
-	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;
diff -Nru a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
--- a/net/bluetooth/rfcomm/core.c	Mon Apr 28 17:05:27 2003
+++ b/net/bluetooth/rfcomm/core.c	Mon Apr 28 17:05:27 2003
@@ -51,7 +51,7 @@
 #include <net/bluetooth/l2cap.h>
 #include <net/bluetooth/rfcomm.h>
 
-#define VERSION "0.4"
+#define VERSION "1.0"
 
 #ifndef CONFIG_BLUEZ_RFCOMM_DEBUG
 #undef  BT_DBG
@@ -1481,7 +1481,7 @@
 	} 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))
@@ -1650,7 +1650,9 @@
 	set_fs(KERNEL_DS);
 
 	while (!atomic_read(&terminate)) {
-		if (!test_and_clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
+		BT_DBG("worker loop event 0x%lx", 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);
@@ -1658,6 +1660,7 @@
 		}
 
 		/* Process stuff */
+		clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
 		rfcomm_process_sessions();
 	}
 	set_current_state(TASK_RUNNING);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-24" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic