From oliver@neukum.org Fri Aug 17 05:01:41 2007 From: Oliver Neukum Date: Fri, 17 Aug 2007 14:01:38 +0200 Subject: USB: fix errornous assumption in the usb serial framework revealed by iuu_phoenix To: gregkh@suse.de, eczema@ecze.com, linux-usb-devel@lists.sourceforge.net Message-ID: <200708171401.39206.oliver@neukum.org> Content-Disposition: inline the iuu_phoenix driver submits another URB from a completion handler. This dictates a certain order of calls to usb_kill_urb() in kill_traffic(). As other drivers may do it the other way round, we need to use both orders in kill_traffic(). This patch does so and should be merged before iuu_phoenix is merged. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb-serial.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -578,6 +578,17 @@ static void kill_traffic(struct usb_seri { usb_kill_urb(port->read_urb); usb_kill_urb(port->write_urb); + /* + * This is tricky. + * Some drivers submit the read_urb in the + * handler for the write_urb or vice versa + * this order determines the order in which + * usb_kill_urb() must be used to reliably + * kill the URBs. As it is unknown here, + * both orders must be used in turn. + * The call below is not redundant. + */ + usb_kill_urb(port->read_urb); usb_kill_urb(port->interrupt_in_urb); usb_kill_urb(port->interrupt_out_urb); }