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: <20200213182246.GA10589@amd>
Date:   Thu, 13 Feb 2020 19:22:46 +0100
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Jean-Francois Dagenais <jeff.dagenais@...il.com>,
        Shubhrajyoti Datta <shubhrajyoti.datta@...inx.com>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 16/52] serial: uartps: Add a timeout to the tx empty
 wait

Hi!

> commit 277375b864e8147975b064b513f491e2a910e66a upstream
> 
> In case the cable is not connected then the target gets into
> an infinite wait for tx empty.
> Add a timeout to the tx empty wait.

Was this tested? Because it does not work...

> Reported-by: Jean-Francois Dagenais <jeff.dagenais@...il.com>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@...inx.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: stable <stable@...r.kernel.org> # 4.19
> Signed-off-by: Mathieu Poirier <mathieu.poirier@...aro.org>
> Signed-off-by: Sasha Levin <sashal@...nel.org>

> @@ -681,16 +683,20 @@ static void cdns_uart_set_termios(struct uart_port *port,
...
> +	int err;
>  
>  	spin_lock_irqsave(&port->lock, flags);
>  
>  	/* Wait for the transmit FIFO to empty before making changes */
>  	if (!(readl(port->membase + CDNS_UART_CR) &
>  				CDNS_UART_CR_TX_DIS)) {
> -		while (!(readl(port->membase + CDNS_UART_SR) &
> -				CDNS_UART_SR_TXEMPTY)) {
> -			cpu_relax();
> +		err = readl_poll_timeout(port->membase + CDNS_UART_SR,
> +					 val, (val & CDNS_UART_SR_TXEMPTY),
> +					 1000, TX_TIMEOUT);
> +		if (err) {
> +			dev_err(port->dev, "timed out waiting for tx empty");
> +			return;
>  		}
>  	}
>

It will return with lock held and interrupts disabled. Mainline takes
spinlock later, so it does not have a problem.

Merging 107475685abfdee504bb0ef4824f15797f6d2d4d before this one
should fix the problem.

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ