tty: limit terminal size to 4M chars
[pandora-kernel.git] / drivers / tty / vt / vt.c
index 632df54..9dc1e2b 100644 (file)
@@ -499,6 +499,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed)
 #endif
        if (DO_UPDATE(vc))
                do_update_region(vc, (unsigned long) p, count);
+       notify_update(vc);
 }
 
 /* used by selection: complement pointer position */
@@ -515,6 +516,7 @@ void complement_pos(struct vc_data *vc, int offset)
                scr_writew(old, screenpos(vc, old_offset, 1));
                if (DO_UPDATE(vc))
                        vc->vc_sw->con_putc(vc, old, oldy, oldx);
+               notify_update(vc);
        }
 
        old_offset = offset;
@@ -532,8 +534,8 @@ void complement_pos(struct vc_data *vc, int offset)
                        oldy = (offset >> 1) / vc->vc_cols;
                        vc->vc_sw->con_putc(vc, new, oldy, oldx);
                }
+               notify_update(vc);
        }
-
 }
 
 static void insert_char(struct vc_data *vc, unsigned int nr)
@@ -880,6 +882,8 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
        if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
                return 0;
 
+       if (new_screen_size > (4 << 20))
+               return -EINVAL;
        newscreen = kmalloc(new_screen_size, GFP_USER);
        if (!newscreen)
                return -ENOMEM;
@@ -1195,7 +1199,7 @@ static void csi_J(struct vc_data *vc, int vpar)
                        break;
                case 3: /* erase scroll-back buffer (and whole display) */
                        scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char,
-                                   vc->vc_screenbuf_size >> 1);
+                                   vc->vc_screenbuf_size);
                        set_origin(vc);
                        if (CON_IS_VISIBLE(vc))
                                update_screen(vc);
@@ -3548,9 +3552,10 @@ static int do_register_con_driver(const struct consw *csw, int first, int last)
                goto err;
 
        desc = csw->con_startup();
-
-       if (!desc)
+       if (!desc) {
+               retval = -ENODEV;
                goto err;
+       }
 
        retval = -EINVAL;