aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2009-10-07 03:30:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-10-09 16:52:08 -0400
commitb2a5cf1bdc011f5474c72543f9d8116c0f07f452 (patch)
tree2e96220f14121811132d3cded43127ed52a13c8a /drivers
parent88fa6590b30ef8c4d41923449ada104f915d8df8 (diff)
USB: serial: fix race between unthrottle and completion handler in symbolserial
usb:usbserial:symbolserial: fix race between unthrottle and completion handler symbol_unthrottle() mustn't resubmit the URB unconditionally as the URB may still be running. the same bug as opticon. Signed-off-by: Oliver Neukum <oliver@neukum.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/serial/symbolserial.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
index cb7e95f9fcbf..f25e54526843 100644
--- a/drivers/usb/serial/symbolserial.c
+++ b/drivers/usb/serial/symbolserial.c
@@ -179,20 +179,24 @@ static void symbol_unthrottle(struct tty_struct *tty)
179 struct symbol_private *priv = usb_get_serial_data(port->serial); 179 struct symbol_private *priv = usb_get_serial_data(port->serial);
180 unsigned long flags; 180 unsigned long flags;
181 int result; 181 int result;
182 bool was_throttled;
182 183
183 dbg("%s - port %d", __func__, port->number); 184 dbg("%s - port %d", __func__, port->number);
184 185
185 spin_lock_irqsave(&priv->lock, flags); 186 spin_lock_irqsave(&priv->lock, flags);
186 priv->throttled = false; 187 priv->throttled = false;
188 was_throttled = priv->actually_throttled;
187 priv->actually_throttled = false; 189 priv->actually_throttled = false;
188 spin_unlock_irqrestore(&priv->lock, flags); 190 spin_unlock_irqrestore(&priv->lock, flags);
189 191
190 priv->int_urb->dev = port->serial->dev; 192 priv->int_urb->dev = port->serial->dev;
191 result = usb_submit_urb(priv->int_urb, GFP_ATOMIC); 193 if (was_throttled) {
192 if (result) 194 result = usb_submit_urb(priv->int_urb, GFP_ATOMIC);
193 dev_err(&port->dev, 195 if (result)
194 "%s - failed submitting read urb, error %d\n", 196 dev_err(&port->dev,
197 "%s - failed submitting read urb, error %d\n",
195 __func__, result); 198 __func__, result);
199 }
196} 200}
197 201
198static int symbol_startup(struct usb_serial *serial) 202static int symbol_startup(struct usb_serial *serial)