serial: imx: do not sysrq broken chars
authorSergey Organov <sorganov@gmail.com>
Wed, 1 Feb 2023 14:26:56 +0000 (17:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Feb 2023 12:11:55 +0000 (13:11 +0100)
Do not call uart_handle_sysrq_char() if we got any receive error along with
the character, as we don't want random junk to be considered a sysrq.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Link: https://lore.kernel.org/r/20230201142700.4346-4-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c

index 2812222..bd5d426 100644 (file)
@@ -913,9 +913,6 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id)
                                continue;
                }
 
-               if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx))
-                       continue;
-
                if (unlikely(rx & URXD_ERR)) {
                        if (rx & URXD_BRK)
                                sport->port.icount.brk++;
@@ -944,6 +941,8 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id)
                                flg = TTY_OVERRUN;
 
                        sport->port.sysrq = 0;
+               } else if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) {
+                       continue;
                }
 
                if (sport->port.ignore_status_mask & URXD_DUMMY_READ)