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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0e0e91b8-72f8-aa31-50e2-80090dd5613a@gmx.de>
Date:   Sun, 2 Jan 2022 16:06:53 +0100
From:   Lino Sanfilippo <LinoSanfilippo@....de>
To:     Lukas Wunner <lukas@...ner.de>, jmades <jochen@...es.net>
Cc:     gregkh@...uxfoundation.org, Russell King <linux@...linux.org.uk>,
        Jiri Slaby <jirislaby@...nel.org>,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Philipp Rosenberger <p.rosenberger@...bus.com>
Subject: Re: [PATCH] Bugfix RTS line config in RS485 mode is overwritten in
 pl011_set_mctrl() function.


Hi,

On 02.01.22 at 11:07, Lukas Wunner wrote:
> On Fri, Dec 31, 2021 at 05:15:14PM +0000, jmades wrote:
>> Based on the "0001-serial-amba-pl011-add-RS485-support.patch" this change is necesarry otherwise the RTS-line will be pulled up in SER_RS485_RTS_BEFORE_SEND mode before sending data. This hinders the driver to receive data, f.ex. when the device is an RS485 slave device.
>>
>> Signed-off-by: jmades <jochen@...es.net>
>
> Patch is correct, but commit message could be improved:
>
> * Subject should be in imperative mood (by convention), it should be
>   prepended by "serial: pl011: " (in line with previous commits touching
>   this driver, use "git log --oneline amba-pl011.c") and the trailing dot
>   is unnecessary, e.g.:
>
>   "serial: pl011: Fix incorrect rs485 RTS polarity on set_mctrl"
>
> * Commit message should be wrapped at 72 characters (so that it appears
>   centered when displayed with "git log" on an 80 chars terminal).
>   The reference to "0001-serial-amba-pl011-add-RS485-support.patch"
>   should be replaced with a reference to the offending commit, e.g.:
>
>   "Commit 8d479237727c ("serial: amba-pl011: add RS485 support") sought
>   to keep RTS deasserted on set_mctrl if rs485 is enabled.  However it
>   did so only if deasserted RTS polarity is high.  Fix it in case it's
>   low."
>
>   Feel free to copy this to a v2 of your patch and amend as you see fit.
>
> * Add tags for the offending commit:
>
>   Fixes: 8d479237727c ("serial: amba-pl011: add RS485 support")
>   Cc: stable@...r.kernel.org # v5.15+
>
> * Be sure to cc the author of the offending commit.
>
> Thanks,
>
> Lukas
>
>> ---
>>  drivers/tty/serial/amba-pl011.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
>> index 537f37ac4..1749c1498 100644
>> --- a/drivers/tty/serial/amba-pl011.c
>> +++ b/drivers/tty/serial/amba-pl011.c
>> @@ -1646,8 +1646,12 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
>>  	    container_of(port, struct uart_amba_port, port);
>>  	unsigned int cr;
>>
>> -	if (port->rs485.flags & SER_RS485_ENABLED)
>> -		mctrl &= ~TIOCM_RTS;
>> +	if (port->rs485.flags & SER_RS485_ENABLED) {
>> +		if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
>> +			mctrl &= ~TIOCM_RTS;
>> +		else
>> +			mctrl |= TIOCM_RTS;
>> +	}
>>
>>  	cr = pl011_read(uap, REG_CR);

Does this logic really have to be implemented in the driver? It looks as if the serial core already takes
RS485 into account before calling set_mctrls(). At least I get the impression when looking
at uart_tiocmset() and uart_port_dtr_rts(). Also other drivers like imx simply seem to ignore RTS in case
of RS485.

Regards,
Lino

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ