Commit 2339536d authored by Johan Hovold's avatar Johan Hovold

USB: serial: metro-usb: stop I/O after failed open

Make sure to kill the interrupt-in URB after a failed open request.
Apart from saving power (and avoiding stale input after a later
successful open), this also prevents a NULL-deref in the completion
handler if the port is manually unbound.
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 70457786 ("USB: serial: metro-usb: get data from device in Uni-Directional mode.")
Cc: stable <stable@vger.kernel.org>	# 3.5
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 9eabd28e
......@@ -188,7 +188,7 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port)
dev_err(&port->dev,
"%s - failed submitting interrupt in urb, error code=%d\n",
__func__, result);
goto exit;
return result;
}
/* Send activate cmd to device */
......@@ -197,9 +197,14 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port)
dev_err(&port->dev,
"%s - failed to configure device, error code=%d\n",
__func__, result);
goto exit;
goto err_kill_urb;
}
exit:
return 0;
err_kill_urb:
usb_kill_urb(port->interrupt_in_urb);
return result;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment