<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">ChangeSet 1.1043.1.11, 2003/02/17 10:09:00-08:00, baldrick@wanadoo.fr

[PATCH] USB speedtouch: fix speedtouch micro race

The disconnect routine counts the completed_receivers/spare_senders list
to see if the completion handler has finished.  It then kills the tasklet.
However the tasklet was being scheduled after adding to the lists, creating
a micro race.  So schedule the tasklet before adding to the list.


diff -Nru a/drivers/usb/misc/speedtouch.c b/drivers/usb/misc/speedtouch.c
--- a/drivers/usb/misc/speedtouch.c	Tue Feb 18 16:40:50 2003
+++ b/drivers/usb/misc/speedtouch.c	Tue Feb 18 16:40:50 2003
@@ -334,12 +334,11 @@
 		return;
 	}
 
+	tasklet_schedule (&amp;instance-&gt;receive_tasklet);
 	/* may not be in_interrupt() */
 	spin_lock_irqsave (&amp;instance-&gt;completed_receivers_lock, flags);
 	list_add_tail (&amp;rcv-&gt;list, &amp;instance-&gt;completed_receivers);
 	spin_unlock_irqrestore (&amp;instance-&gt;completed_receivers_lock, flags);
-	PDEBUG ("udsl_complete_receive: scheduling tasklet\n");
-	tasklet_schedule (&amp;instance-&gt;receive_tasklet);
 }
 
 static void udsl_process_receive (unsigned long data)
@@ -497,13 +496,12 @@
 		return;
 	}
 
+	tasklet_schedule (&amp;instance-&gt;send_tasklet);
 	/* may not be in_interrupt() */
 	spin_lock_irqsave (&amp;instance-&gt;send_lock, flags);
 	list_add (&amp;snd-&gt;list, &amp;instance-&gt;spare_senders);
 	list_add (&amp;snd-&gt;buffer-&gt;list, &amp;instance-&gt;spare_buffers);
 	spin_unlock_irqrestore (&amp;instance-&gt;send_lock, flags);
-	PDEBUG ("udsl_complete_send: scheduling tasklet\n");
-	tasklet_schedule (&amp;instance-&gt;send_tasklet);
 }
 
 static void udsl_process_send (unsigned long data)
</pre></body></html>