]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.44/usb-serial-ch341-fix-open-error-handling.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.44 / usb-serial-ch341-fix-open-error-handling.patch
CommitLineData
0f4bf3ee
GKH
1From f2950b78547ffb8475297ada6b92bc2d774d5461 Mon Sep 17 00:00:00 2001
2From: Johan Hovold <johan@kernel.org>
3Date: Fri, 6 Jan 2017 19:15:13 +0100
4Subject: USB: serial: ch341: fix open error handling
5
6From: Johan Hovold <johan@kernel.org>
7
8commit f2950b78547ffb8475297ada6b92bc2d774d5461 upstream.
9
10Make sure to stop the interrupt URB before returning on errors during
11open.
12
13Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS")
14Signed-off-by: Johan Hovold <johan@kernel.org>
15Signed-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