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: <20221121202724.1708460-1-michael@walle.cc>
Date:   Mon, 21 Nov 2022 21:27:24 +0100
From:   Michael Walle <michael@...le.cc>
To:     jirislaby@...nel.org
Cc:     afaerber@...e.de, alexandre.belloni@...tlin.com,
        claudiu.beznea@...rochip.com, festevam@...il.com,
        gregkh@...uxfoundation.org, ilpo.jarvinen@...ux.intel.com,
        kernel@...gutronix.de, linux-imx@....com,
        linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
        liviu.dudau@....com, lorenzo.pieralisi@....com, mani@...nel.org,
        nicolas.ferre@...rochip.com, richard.genoud@...il.com,
        s.hauer@...gutronix.de, shawnguo@...nel.org, sudeep.holla@....com,
        tklauser@...tanz.ch, vz@...ia.com
Subject: Re: [PATCH v5 2/3] tty: serial: use uart_port_tx() helper

From: "Jiri Slaby (SUSE)" <jirislaby@...nel.org>

Hi Jiri,

> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index bd07f79a2df9..a6b4d30c5888 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -824,30 +824,14 @@ static void atmel_rx_chars(struct uart_port *port)
>   */
>  static void atmel_tx_chars(struct uart_port *port)
>  {
> -	struct circ_buf *xmit = &port->state->xmit;
>  	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
> +	bool pending;
> +	u8 ch;
>  
> -	if (port->x_char &&
> -	    (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY)) {
> -		atmel_uart_write_char(port, port->x_char);
> -		port->icount.tx++;
> -		port->x_char = 0;
> -	}
> -	if (uart_circ_empty(xmit) || uart_tx_stopped(port))
> -		return;
> -
> -	while (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY) {
> -		atmel_uart_write_char(port, xmit->buf[xmit->tail]);
> -		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> -		port->icount.tx++;
> -		if (uart_circ_empty(xmit))
> -			break;
> -	}
> -
> -	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
> -		uart_write_wakeup(port);
> -
> -	if (!uart_circ_empty(xmit)) {
> +	pending = uart_port_tx(port, ch,
> +		atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY,
> +		atmel_uart_write_char(port, ch));
> +	if (pending) {
>  		/* we still have characters to transmit, so we should continue
>  		 * transmitting them when TX is ready, regardless of
>  		 * mode or duplexity

This will break serial output for the userspace on my board
(arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt*dts). The uart_port_tx()
helper will call __port->ops->stop_tx(__port) if uart_circ_chars_pending()
returns 0. But the code above, doesn't do that. In fact, removing the
stop_tx() call in the helper macro, will fix the console output.

Any ideas how to fix that?

-michael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ