lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <E0AAFEFF-2250-4991-8ED8-9B6EE14111EC@silabs.com>
Date:   Thu, 21 Jan 2021 09:52:23 +0000
From:   Pho Tran <Pho.Tran@...abs.com>
To:     "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "johan@...nel.org" <johan@...nel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>
Subject: [PATCH v4] USB: serial: cp210x: Fix error 32 when hardware flow
 control  is enabled.

Fix error 32 returned by CP210X_SET_MHS when hardware flow control is enabled.

The root cause of error 32 is that user application (CoolTerm, linux-serial-test)
opened cp210x device with hardware flow control then attempt to control RTS/DTR pins.
In hardware flow control, RTS/DTR pins will be controlled by hardware only,
any attempt to control those pins will cause error 32 from the device.
This fix will block MHS command(command to control RTS/DTR pins) to the device
if hardware flow control is being used.

Signed-off-by: Pho Tran <pho.tran@...abs.com>
---
01/21/2021: Patch v3 modified based on comment from Greg Kroah-Hartman <gregkh@...uxfoundation.org>
01/19/2021: Patch v2  Modified based on comment from Johan Hovold <johan@...nel.org>
and Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
 drivers/usb/serial/cp210x.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index fbb10dfc56e3..814dff5fee98 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -1204,7 +1204,12 @@ static int cp210x_tiocmset(struct tty_struct *tty,
 		unsigned int set, unsigned int clear)
 {
 	struct usb_serial_port *port = tty->driver_data;
-	return cp210x_tiocmset_port(port, set, clear);
+
+	/* Don't send SET_MHS command if device in hardware flow control mode. */
+	if (C_CRTSCTS(tty))
+		return 0;
+	else
+		return cp210x_tiocmset_port(port, set, clear);
 }
 
 static int cp210x_tiocmset_port(struct usb_serial_port *port,
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ