From: Peter Hurley Date: Tue, 2 Sep 2014 21:39:14 +0000 (-0400) Subject: serial: core: Remove unsafe x_char optimization X-Git-Tag: firefly_0821_release~176^2~3120^2~69 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fba594a848f6f35417a358565086d22c533c19c8;hp=c235ccc1c4d6fd8b7d48b976b87416230ffd5149;p=firefly-linux-kernel-4.4.55.git serial: core: Remove unsafe x_char optimization uart_unthrottle() attempts to avoid sending START and the previous x_char if the previous x_char has not yet been sent. However, this optimization could leave the sender in a throttled state; for example, if the sender is throttled and this unthrottle coincides with a manual tcflow(TCION) from user-space, then neither START would be sent. Signed-off-by: Peter Hurley Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index bd20cf51e912..bdc543caf069 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -647,12 +647,8 @@ static void uart_unthrottle(struct tty_struct *tty) mask &= ~port->flags; } - if (mask & UPF_SOFT_FLOW) { - if (port->x_char) - port->x_char = 0; - else - uart_send_xchar(tty, START_CHAR(tty)); - } + if (mask & UPF_SOFT_FLOW) + uart_send_xchar(tty, START_CHAR(tty)); if (mask & UPF_HARD_FLOW) uart_set_mctrl(port, TIOCM_RTS);