aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/sierra.c
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.de>2007-03-20 08:54:05 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 16:28:37 -0400
commitebcf3ede6d84bf8aeff4378035d3fb312ede8dc9 (patch)
tree06bbf9d37e53ed1eb3afaba4a5d35c755d03f26a /drivers/usb/serial/sierra.c
parent7d28e74b97c8eb859fd9f5eb018bb1c75627bd55 (diff)
USB: sierra close race
the sierra driver does not directly use usb_kill_urb(). It uses a wrapper. This wrapper means that callbacks which are running are not killed during close, resubmitting and illicitly pushing data into the tty layer. The whole purpose of usb_kill_urb() is subverted. The wrapper must be removed. The same problem as the option driver. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/sierra.c')
-rw-r--r--drivers/usb/serial/sierra.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index ecedd833818d..4865aff892e8 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -456,12 +456,6 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp)
456 return (0); 456 return (0);
457} 457}
458 458
459static inline void stop_urb(struct urb *urb)
460{
461 if (urb && urb->status == -EINPROGRESS)
462 usb_kill_urb(urb);
463}
464
465static void sierra_close(struct usb_serial_port *port, struct file *filp) 459static void sierra_close(struct usb_serial_port *port, struct file *filp)
466{ 460{
467 int i; 461 int i;
@@ -479,9 +473,9 @@ static void sierra_close(struct usb_serial_port *port, struct file *filp)
479 473
480 /* Stop reading/writing urbs */ 474 /* Stop reading/writing urbs */
481 for (i = 0; i < N_IN_URB; i++) 475 for (i = 0; i < N_IN_URB; i++)
482 stop_urb(portdata->in_urbs[i]); 476 usb_unlink_urb(portdata->in_urbs[i]);
483 for (i = 0; i < N_OUT_URB; i++) 477 for (i = 0; i < N_OUT_URB; i++)
484 stop_urb(portdata->out_urbs[i]); 478 usb_unlink_urb(portdata->out_urbs[i]);
485 } 479 }
486 port->tty = NULL; 480 port->tty = NULL;
487} 481}
@@ -585,9 +579,9 @@ static void sierra_shutdown(struct usb_serial *serial)
585 port = serial->port[i]; 579 port = serial->port[i];
586 portdata = usb_get_serial_port_data(port); 580 portdata = usb_get_serial_port_data(port);
587 for (j = 0; j < N_IN_URB; j++) 581 for (j = 0; j < N_IN_URB; j++)
588 stop_urb(portdata->in_urbs[j]); 582 usb_unlink_urb(portdata->in_urbs[j]);
589 for (j = 0; j < N_OUT_URB; j++) 583 for (j = 0; j < N_OUT_URB; j++)
590 stop_urb(portdata->out_urbs[j]); 584 usb_unlink_urb(portdata->out_urbs[j]);
591 } 585 }
592 586
593 /* Now free them */ 587 /* Now free them */