Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / drivers / tty / vt / vt.c
index 23b5d32954bfc9365ec6453d69e331e975ca8d0e..3ad0b61e35b47b00fa874c6bb1ab394499f9a168 100644 (file)
@@ -1590,9 +1590,9 @@ static void restore_cur(struct vc_data *vc)
        vc->vc_need_wrap = 0;
 }
 
-enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
+enum { ESnormal, ESesc, ESsquare, ESgetpars, ESfunckey,
        EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
-       ESpalette };
+       ESpalette, ESosc };
 
 /* console_lock is held (except via vc_init()) */
 static void reset_terminal(struct vc_data *vc, int do_clear)
@@ -1652,11 +1652,15 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
         *  Control characters can be used in the _middle_
         *  of an escape sequence.
         */
+       if (vc->vc_state == ESosc && c>=8 && c<=13) /* ... except for OSC */
+               return;
        switch (c) {
        case 0:
                return;
        case 7:
-               if (vc->vc_bell_duration)
+               if (vc->vc_state == ESosc)
+                       vc->vc_state = ESnormal;
+               else if (vc->vc_bell_duration)
                        kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration);
                return;
        case 8:
@@ -1767,7 +1771,9 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
                } else if (c=='R') {   /* reset palette */
                        reset_palette(vc);
                        vc->vc_state = ESnormal;
-               } else
+               } else if (c>='0' && c<='9')
+                       vc->vc_state = ESosc;
+               else
                        vc->vc_state = ESnormal;
                return;
        case ESpalette:
@@ -1807,9 +1813,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
                        vc->vc_par[vc->vc_npar] *= 10;
                        vc->vc_par[vc->vc_npar] += c - '0';
                        return;
-               } else
-                       vc->vc_state = ESgotpars;
-       case ESgotpars:
+               }
                vc->vc_state = ESnormal;
                switch(c) {
                case 'h':
@@ -2023,6 +2027,8 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
                        vc->vc_translate = set_translate(vc->vc_G1_charset, vc);
                vc->vc_state = ESnormal;
                return;
+       case ESosc:
+               return;
        default:
                vc->vc_state = ESnormal;
        }