Return-Path: Received: from mail-bn3nam01on0121.outbound.protection.outlook.com ([104.47.33.121]:35342 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754918AbeARVCS (ORCPT ); Thu, 18 Jan 2018 16:02:18 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Lukas Wunner , Greg Kroah-Hartman , Sasha Levin Subject: [added to the 4.1 stable tree] serial: 8250_fintek: Fix rs485 disablement on invalid ioctl() Date: Thu, 18 Jan 2018 21:00:26 +0000 Message-ID: <20180118205908.3220-116-alexander.levin@microsoft.com> References: <20180118205908.3220-1-alexander.levin@microsoft.com> In-Reply-To: <20180118205908.3220-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Lukas Wunner This patch has been added to the stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 3236a965486ba0c6043cf2c7b51943d8b382ae29 ] This driver's ->rs485_config callback checks if SER_RS485_RTS_ON_SEND and SER_RS485_RTS_AFTER_SEND have the same value. If they do, it means the user has passed in invalid data with the TIOCSRS485 ioctl() since RTS must have a different polarity when sending and when not sending. In this case, rs485 mode is not enabled (the RS485_URA bit is not set in the RS485 Enable Register) and this is supposed to be signaled back to the user by clearing the SER_RS485_ENABLED bit in struct serial_rs485 ... except a missing tilde character is preventing that from happening. Fixes: 28e3fb6c4dce ("serial: Add support for Fintek F81216A LPC to 4 UART"= ) Cc: Ricardo Ribalda Delgado Cc: "Ji-Ze Hong (Peter Hong)" Signed-off-by: Lukas Wunner Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_fintek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_fintek.c b/drivers/tty/serial/825= 0/8250_fintek.c index 5815e81b5fc6..a8a6fe6fc924 100644 --- a/drivers/tty/serial/8250/8250_fintek.c +++ b/drivers/tty/serial/8250/8250_fintek.c @@ -118,7 +118,7 @@ static int fintek_8250_rs485_config(struct uart_port *p= ort, =20 if ((!!(rs485->flags & SER_RS485_RTS_ON_SEND)) =3D=3D (!!(rs485->flags & SER_RS485_RTS_AFTER_SEND))) - rs485->flags &=3D SER_RS485_ENABLED; + rs485->flags &=3D ~SER_RS485_ENABLED; else config |=3D RS485_URA; =20 --=20 2.11.0