[rfd]race between suspend and throttling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am unsure how much locking the freezer will give us. Thus here's a
patch on the assumption that the freezer protects us. Comments?

	Regards
		Oliver
--

commit 519f749bf8e1c538b7578d3dea42fb54c4346d29
Author: Oliver Neukum <oliver@xxxxxxxxxx>
Date:   Wed Oct 21 15:33:53 2009 +0200

    usb:usbserial: fix race throttling/suspend
    
    - don't resume read urbs on throttled ports

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index bbe005c..a6be8e2 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -544,7 +544,7 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
 	port->throttled = port->throttle_req = 0;
 	spin_unlock_irqrestore(&port->lock, flags);
 
-	if (was_throttled) {
+	if (was_throttled && !port->serial->suspending) {
 		/* Resume reading from device */
 		flush_and_resubmit_read_urb(port);
 	}
@@ -587,9 +587,16 @@ int usb_serial_generic_resume(struct usb_serial *serial)
 			continue;
 
 		if (port->read_urb) {
-			r = usb_submit_urb(port->read_urb, GFP_NOIO);
-			if (r < 0)
-				c++;
+			spin_lock_irq(&port->lock);
+			if (port->throttle_req) {
+				port->throttled = 1;
+				spin_unlock_irq(&port->lock);
+			} else {
+				spin_unlock_irq(&port->lock);
+				r = usb_submit_urb(port->read_urb, GFP_NOIO);
+				if (r < 0)
+					c++;
+			}
 		}
 
 		if (port->write_urb) {

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux