From: <gregkh@linuxfoundation.org>
To: johan@kernel.org, gregkh@linuxfoundation.org
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "USB: serial: ch341: fix modem-status handling" has been added to the 4.10-stable tree
Date: Tue, 09 May 2017 11:21:17 +0200 [thread overview]
Message-ID: <1494321677163191@kroah.com> (raw)
This is a note to let you know that I've just added the patch titled
USB: serial: ch341: fix modem-status handling
to the 4.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
usb-serial-ch341-fix-modem-status-handling.patch
and it can be found in the queue-4.10 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From a0467a967f347842b30739aae636c44980265265 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@kernel.org>
Date: Fri, 6 Jan 2017 19:15:17 +0100
Subject: USB: serial: ch341: fix modem-status handling
From: Johan Hovold <johan@kernel.org>
commit a0467a967f347842b30739aae636c44980265265 upstream.
The modem-status register was read as part of device configuration at
port_probe and then again at open (and reset-resume). During open (and
reset-resume) the MSR was read before submitting the interrupt URB,
something which could lead to an MSR-change going unnoticed when it
races with open (reset-resume).
Fix this by dropping the redundant reconfiguration of the port at every
open, and only read the MSR after the interrupt URB has been submitted.
Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/ch341.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -248,21 +248,11 @@ static int ch341_configure(struct usb_de
if (r < 0)
goto out;
- /* expect 0xff 0xee */
- r = ch341_get_status(dev, priv);
- if (r < 0)
- goto out;
-
r = ch341_set_baudrate_lcr(dev, priv, priv->lcr);
if (r < 0)
goto out;
r = ch341_set_handshake(dev, priv->line_control);
- if (r < 0)
- goto out;
-
- /* expect 0x9f 0xee */
- r = ch341_get_status(dev, priv);
out: kfree(buffer);
return r;
@@ -334,14 +324,9 @@ static void ch341_close(struct usb_seria
/* open this device, set default parameters */
static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port)
{
- struct usb_serial *serial = port->serial;
struct ch341_private *priv = usb_get_serial_port_data(port);
int r;
- r = ch341_configure(serial->dev, priv);
- if (r)
- return r;
-
if (tty)
ch341_set_termios(tty, port, NULL);
@@ -353,6 +338,12 @@ static int ch341_open(struct tty_struct
return r;
}
+ r = ch341_get_status(port->serial->dev, priv);
+ if (r < 0) {
+ dev_err(&port->dev, "failed to read modem status: %d\n", r);
+ goto err_kill_interrupt_urb;
+ }
+
r = usb_serial_generic_open(tty, port);
if (r)
goto err_kill_interrupt_urb;
@@ -619,6 +610,12 @@ static int ch341_reset_resume(struct usb
ret);
return ret;
}
+
+ ret = ch341_get_status(port->serial->dev, priv);
+ if (ret < 0) {
+ dev_err(&port->dev, "failed to read modem status: %d\n",
+ ret);
+ }
}
return usb_serial_generic_resume(serial);
Patches currently in stable-queue which might be from johan@kernel.org are
queue-4.10/usb-serial-mct_u232-fix-modem-status-error-handling.patch
queue-4.10/usb-serial-ark3116-fix-open-error-handling.patch
queue-4.10/usb-serial-io_edgeport-fix-epic-descriptor-handling.patch
queue-4.10/usb-serial-ti_usb_3410_5052-fix-control-message-error-handling.patch
queue-4.10/usb-serial-keyspan_pda-fix-receive-sanity-checks.patch
queue-4.10/usb-serial-sierra-fix-bogus-alternate-setting-assumption.patch
queue-4.10/usb-serial-ssu100-fix-control-message-error-handling.patch
queue-4.10/usb-serial-digi_acceleport-fix-incomplete-rx-sanity-check.patch
queue-4.10/usb-serial-ch341-fix-modem-status-handling.patch
queue-4.10/usb-serial-io_edgeport-fix-descriptor-error-handling.patch
queue-4.10/usb-serial-quatech2-fix-control-message-error-handling.patch
queue-4.10/usb-serial-ftdi_sio-fix-latency-timer-error-handling.patch
reply other threads:[~2017-05-09 9:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1494321677163191@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=stable-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).