Linux-Serial Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] tty: serial: 21285: fix lockup on open
@ 2020-10-18  8:42 Russell King
  2020-10-19  7:00 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Russell King @ 2020-10-18  8:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-arm-kernel, linux-serial

Commit 293f89959483 ("tty: serial: 21285: stop using the unused[]
variable from struct uart_port") introduced a bug which stops the
transmit interrupt being disabled when there are no characters to
transmit - disabling the transmit interrupt at the interrupt controller
is the only way to stop an interrupt storm. If this interrupt is not
disabled when there are no transmit characters, we end up with an
interrupt storm which prevents the machine making forward progress.

Fixes: 293f89959483 ("tty: serial: 21285: stop using the unused[] variable from struct uart_port")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/tty/serial/21285.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/21285.c b/drivers/tty/serial/21285.c
index 718e010fcb04..09baef4ccc39 100644
--- a/drivers/tty/serial/21285.c
+++ b/drivers/tty/serial/21285.c
@@ -50,25 +50,25 @@ static const char serial21285_name[] = "Footbridge UART";
 
 static bool is_enabled(struct uart_port *port, int bit)
 {
-	unsigned long private_data = (unsigned long)port->private_data;
+	unsigned long *private_data = (unsigned long *)&port->private_data;
 
-	if (test_bit(bit, &private_data))
+	if (test_bit(bit, private_data))
 		return true;
 	return false;
 }
 
 static void enable(struct uart_port *port, int bit)
 {
-	unsigned long private_data = (unsigned long)port->private_data;
+	unsigned long *private_data = (unsigned long *)&port->private_data;
 
-	set_bit(bit, &private_data);
+	set_bit(bit, private_data);
 }
 
 static void disable(struct uart_port *port, int bit)
 {
-	unsigned long private_data = (unsigned long)port->private_data;
+	unsigned long *private_data = (unsigned long *)&port->private_data;
 
-	clear_bit(bit, &private_data);
+	clear_bit(bit, private_data);
 }
 
 #define is_tx_enabled(port)	is_enabled(port, tx_enabled_bit)
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] tty: serial: 21285: fix lockup on open
  2020-10-18  8:42 [PATCH] tty: serial: 21285: fix lockup on open Russell King
@ 2020-10-19  7:00 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2020-10-19  7:00 UTC (permalink / raw)
  To: Russell King; +Cc: Jiri Slaby, linux-arm-kernel, linux-serial

On Sun, Oct 18, 2020 at 09:42:04AM +0100, Russell King wrote:
> Commit 293f89959483 ("tty: serial: 21285: stop using the unused[]
> variable from struct uart_port") introduced a bug which stops the
> transmit interrupt being disabled when there are no characters to
> transmit - disabling the transmit interrupt at the interrupt controller
> is the only way to stop an interrupt storm. If this interrupt is not
> disabled when there are no transmit characters, we end up with an
> interrupt storm which prevents the machine making forward progress.
> 
> Fixes: 293f89959483 ("tty: serial: 21285: stop using the unused[] variable from struct uart_port")
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/tty/serial/21285.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/tty/serial/21285.c b/drivers/tty/serial/21285.c
> index 718e010fcb04..09baef4ccc39 100644
> --- a/drivers/tty/serial/21285.c
> +++ b/drivers/tty/serial/21285.c
> @@ -50,25 +50,25 @@ static const char serial21285_name[] = "Footbridge UART";
>  
>  static bool is_enabled(struct uart_port *port, int bit)
>  {
> -	unsigned long private_data = (unsigned long)port->private_data;
> +	unsigned long *private_data = (unsigned long *)&port->private_data;
>  
> -	if (test_bit(bit, &private_data))
> +	if (test_bit(bit, private_data))
>  		return true;
>  	return false;
>  }
>  
>  static void enable(struct uart_port *port, int bit)
>  {
> -	unsigned long private_data = (unsigned long)port->private_data;
> +	unsigned long *private_data = (unsigned long *)&port->private_data;
>  
> -	set_bit(bit, &private_data);
> +	set_bit(bit, private_data);
>  }
>  
>  static void disable(struct uart_port *port, int bit)
>  {
> -	unsigned long private_data = (unsigned long)port->private_data;
> +	unsigned long *private_data = (unsigned long *)&port->private_data;
>  
> -	clear_bit(bit, &private_data);
> +	clear_bit(bit, private_data);
>  }
>  
>  #define is_tx_enabled(port)	is_enabled(port, tx_enabled_bit)
> -- 
> 2.20.1
> 

Sorry about this, my fault.  I'll merge this after 5.10-rc1 is out,
thanks for the fix.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-18  8:42 [PATCH] tty: serial: 21285: fix lockup on open Russell King
2020-10-19  7:00 ` Greg Kroah-Hartman

Linux-Serial Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-serial/0 linux-serial/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-serial linux-serial/ https://lore.kernel.org/linux-serial \
		linux-serial@vger.kernel.org
	public-inbox-index linux-serial

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-serial


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git