Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39434abd authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman
Browse files

n_tty: Fix missing newline echo



When L_ECHONL is on, newlines are echoed regardless of the L_ECHO
state; if set, ensure accumulated echoes are flushed before finishing
the current input processing and before more output.

Cc: <stable@vger.kernel.org> # 3.12.x
Reported-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tested-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c42b4e65
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -810,7 +810,8 @@ static void process_echoes(struct tty_struct *tty)
	struct n_tty_data *ldata = tty->disc_data;
	size_t echoed;

	if (!L_ECHO(tty) || ldata->echo_commit == ldata->echo_tail)
	if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
	    ldata->echo_commit == ldata->echo_tail)
		return;

	mutex_lock(&ldata->output_lock);
@@ -825,7 +826,8 @@ static void flush_echoes(struct tty_struct *tty)
{
	struct n_tty_data *ldata = tty->disc_data;

	if (!L_ECHO(tty) || ldata->echo_commit == ldata->echo_head)
	if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
	    ldata->echo_commit == ldata->echo_head)
		return;

	mutex_lock(&ldata->output_lock);