speedtch usbatm.c,1.66,1.67

Duncan Sands duncan at infradead.org
Fri Sep 29 05:34:37 EDT 2006


Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv18745

Modified Files:
	usbatm.c 
Log Message:
Fix for very unlikely race: if the thread manages to exit
before pid was assigned, pid will not be set to -1, and
the wrong thread may be shot down on modem disconnect.


Index: usbatm.c
===================================================================
RCS file: /home/cvs/speedtch/usbatm.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- usbatm.c	22 Mar 2006 17:00:48 -0000	1.66
+++ usbatm.c	29 Sep 2006 09:34:34 -0000	1.67
@@ -1001,6 +1001,7 @@
 
 	daemonize(instance->driver->driver_name);
 	allow_signal(SIGTERM);
+	instance->thread_pid = get_current()->pid;
 
 	complete(&instance->thread_started);
 
@@ -1025,10 +1026,6 @@
 		return ret;
 	}
 
-	mutex_lock(&instance->serialize);
-	instance->thread_pid = ret;
-	mutex_unlock(&instance->serialize);
-
 	wait_for_completion(&instance->thread_started);
 
 	return 0;




More information about the Usbatm-commits mailing list