Skip to content

Commit

Permalink
USB: serial: ch341: fix open error handling
Browse files Browse the repository at this point in the history
Make sure to stop the interrupt URB before returning on errors during
open.

Fixes: 664d5df ("USB: usb-serial ch341: support for DTR/RTS/CTS")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
  • Loading branch information
Johan Hovold committed Jan 9, 2017
1 parent 030ee7a commit f2950b7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/usb/serial/ch341.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port)

r = ch341_configure(serial->dev, priv);
if (r)
goto out;
return r;

if (tty)
ch341_set_termios(tty, port, NULL);
Expand All @@ -329,12 +329,19 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port)
if (r) {
dev_err(&port->dev, "%s - failed to submit interrupt urb: %d\n",
__func__, r);
goto out;
return r;
}

r = usb_serial_generic_open(tty, port);
if (r)
goto err_kill_interrupt_urb;

return 0;

err_kill_interrupt_urb:
usb_kill_urb(port->interrupt_in_urb);

out: return r;
return r;
}

/* Old_termios contains the original termios settings and
Expand Down

0 comments on commit f2950b7

Please sign in to comment.