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] [day] [month] [year] [list]
Message-ID: <2025102231-fender-bovine-ecd9@gregkh>
Date: Wed, 22 Oct 2025 11:57:44 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Peng Zhang <zhangpeng.00@...edance.com>
Cc: jirislaby@...nel.org, ilpo.jarvinen@...ux.intel.com,
	linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
	songmuchun@...edance.com, stable@...r.kernel.org
Subject: Re: [PATCH v2] serial: 8250: always disable IRQ during THRE test

On Thu, Oct 16, 2025 at 03:05:16PM +0800, Peng Zhang wrote:
> commit 039d4926379b ("serial: 8250: Toggle IER bits on only after irq
> has been set up") moved IRQ setup before the THRE test, so the interrupt
> handler can run during the test and race with its IIR reads. This can
> produce wrong THRE test results and cause spurious registration of the
> serial8250_backup_timeout timer. Unconditionally disable the IRQ for the
> short duration of the test and re-enable it afterwards to avoid the race.
> 
> Cc: stable@...r.kernel.org
> Fixes: 039d4926379b ("serial: 8250: Toggle IER bits on only after irq has been set up")
> Signed-off-by: Peng Zhang <zhangpeng.00@...edance.com>
> ---
>  drivers/tty/serial/8250/8250_port.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 719faf92aa8a..f1740cc91143 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -2147,8 +2147,7 @@ static void serial8250_THRE_test(struct uart_port *port)
>  	if (up->port.flags & UPF_NO_THRE_TEST)
>  		return;
>  
> -	if (port->irqflags & IRQF_SHARED)
> -		disable_irq_nosync(port->irq);
> +	disable_irq(port->irq);
>  
>  	/*
>  	 * Test for UARTs that do not reassert THRE when the transmitter is idle and the interrupt
> @@ -2170,8 +2169,7 @@ static void serial8250_THRE_test(struct uart_port *port)
>  		serial_port_out(port, UART_IER, 0);
>  	}
>  
> -	if (port->irqflags & IRQF_SHARED)
> -		enable_irq(port->irq);
> +	enable_irq(port->irq);
>  
>  	/*
>  	 * If the interrupt is not reasserted, or we otherwise don't trust the iir, setup a timer to
> -- 
> 2.20.1
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ