aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-11-29 12:56:10 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-29 15:53:19 -0500
commit39434abd942c8e4b9c14c06a03b3245beaf8467f (patch)
treed171ad4472ae3ac4b70679a3fcd71cc43bbd8583 /drivers/tty/n_tty.c
parentc42b4e6501cdaabee8cc292ae1ef0f66bf4825c1 (diff)
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: Jason Gunthorpe <jgunthorpe@obsidianresearch.com Tested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r--drivers/tty/n_tty.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 0f74945af624..268b62768f2b 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -810,7 +810,8 @@ static void process_echoes(struct tty_struct *tty)
810 struct n_tty_data *ldata = tty->disc_data; 810 struct n_tty_data *ldata = tty->disc_data;
811 size_t echoed; 811 size_t echoed;
812 812
813 if (!L_ECHO(tty) || ldata->echo_commit == ldata->echo_tail) 813 if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
814 ldata->echo_commit == ldata->echo_tail)
814 return; 815 return;
815 816
816 mutex_lock(&ldata->output_lock); 817 mutex_lock(&ldata->output_lock);
@@ -825,7 +826,8 @@ static void flush_echoes(struct tty_struct *tty)
825{ 826{
826 struct n_tty_data *ldata = tty->disc_data; 827 struct n_tty_data *ldata = tty->disc_data;
827 828
828 if (!L_ECHO(tty) || ldata->echo_commit == ldata->echo_head) 829 if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
830 ldata->echo_commit == ldata->echo_head)
829 return; 831 return;
830 832
831 mutex_lock(&ldata->output_lock); 833 mutex_lock(&ldata->output_lock);