mxser: increase buf_overrun if tty_insert_flip_char() fails
authorJiri Slaby <jslaby@suse.cz>
Thu, 18 Nov 2021 07:31:22 +0000 (08:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 11:02:17 +0000 (12:02 +0100)
[ Upstream commit eb68ac0462bffc2ceb63b3a76737d6c9f186e6de ]

mxser doesn't increase port->icount.buf_overrun at all. Do so if overrun
happens, so that it can be read from the stats.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20211118073125.12283-17-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/mxser.c

index 3b5d193b7f24553d19210377174ad95c288fe4b2..39458b42df7b071fbcdfa6d4a7402f279ed36815 100644 (file)
@@ -1536,7 +1536,8 @@ static bool mxser_receive_chars_new(struct tty_struct *tty,
 
        while (gdl--) {
                u8 ch = inb(port->ioaddr + UART_RX);
-               tty_insert_flip_char(&port->port, ch, 0);
+               if (!tty_insert_flip_char(&port->port, ch, 0))
+                       port->icount.buf_overrun++;
        }
 
        return true;
@@ -1582,8 +1583,10 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty,
                                        port->icount.overrun++;
                                }
                        }
-                       if (!tty_insert_flip_char(&port->port, ch, flag))
+                       if (!tty_insert_flip_char(&port->port, ch, flag)) {
+                               port->icount.buf_overrun++;
                                break;
+                       }
                }
 
                if (hwid)