]>
Commit | Line | Data |
---|---|---|
0f4bf3ee GKH |
1 | From f2950b78547ffb8475297ada6b92bc2d774d5461 Mon Sep 17 00:00:00 2001 |
2 | From: Johan Hovold <johan@kernel.org> | |
3 | Date: Fri, 6 Jan 2017 19:15:13 +0100 | |
4 | Subject: USB: serial: ch341: fix open error handling | |
5 | ||
6 | From: Johan Hovold <johan@kernel.org> | |
7 | ||
8 | commit f2950b78547ffb8475297ada6b92bc2d774d5461 upstream. | |
9 | ||
10 | Make sure to stop the interrupt URB before returning on errors during | |
11 | open. | |
12 | ||
13 | Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS") | |
14 | Signed-off-by: Johan Hovold <johan@kernel.org> | |
15 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
16 | ||
17 | --- | |
18 | drivers/usb/serial/ch341.c | 13 ++++++++++--- | |
19 | 1 file changed, 10 insertions(+), 3 deletions(-) | |
20 | ||
21 | --- a/drivers/usb/serial/ch341.c | |
22 | +++ b/drivers/usb/serial/ch341.c | |
23 | @@ -314,7 +314,7 @@ static int ch341_open(struct tty_struct | |
24 | ||
25 | r = ch341_configure(serial->dev, priv); | |
26 | if (r) | |
27 | - goto out; | |
28 | + return r; | |
29 | ||
30 | if (tty) | |
31 | ch341_set_termios(tty, port, NULL); | |
32 | @@ -324,12 +324,19 @@ static int ch341_open(struct tty_struct | |
33 | if (r) { | |
34 | dev_err(&port->dev, "%s - failed to submit interrupt urb: %d\n", | |
35 | __func__, r); | |
36 | - goto out; | |
37 | + return r; | |
38 | } | |
39 | ||
40 | r = usb_serial_generic_open(tty, port); | |
41 | + if (r) | |
42 | + goto err_kill_interrupt_urb; | |
43 | + | |
44 | + return 0; | |
45 | + | |
46 | +err_kill_interrupt_urb: | |
47 | + usb_kill_urb(port->interrupt_in_urb); | |
48 | ||
49 | -out: return r; | |
50 | + return r; | |
51 | } | |
52 | ||
53 | /* Old_termios contains the original termios settings and |