[PATCH] fbcon fixes

From: Geert Uytterhoeven (geert@linux-m68k.org)
Date: Sun Jun 15 2003 - 14:10:30 EST


Fbcon:
  - Make PROC_CONSOLE() return -1 when the virtual console does not belong to
    the specified fbdev. This way we prevent messing with the wrong fb_info[i]
    later when running fbset from the `wrong' virtual console on multi-headed
    systems.
  - Validate the current cursor position before undrawing the cursor in
    fbcon_cursor(). If we just shrank the frame buffer size, the old cursor
    position may now lay outside the frame buffer region.

--- linux-2.4.x/drivers/video/fbcon.c.orig Wed Apr 2 13:26:09 2003
+++ linux-2.4.x/drivers/video/fbcon.c Wed Apr 9 15:33:07 2003
@@ -272,23 +272,22 @@
 int PROC_CONSOLE(const struct fb_info *info)
 {
         int fgc;
-
- if (info->display_fg != NULL)
- fgc = info->display_fg->vc_num;
- else
- return -1;
-
- if (!current->tty)
- return fgc;
-
- if (current->tty->driver.type != TTY_DRIVER_TYPE_CONSOLE)
- /* XXX Should report error here? */
- return fgc;
 
- if (MINOR(current->tty->device) < 1)
- return fgc;
+ if (info->display_fg == NULL)
+ return -1;
 
- return MINOR(current->tty->device) - 1;
+ if (!current->tty ||
+ current->tty->driver.type != TTY_DRIVER_TYPE_CONSOLE ||
+ MINOR(current->tty->device) < 1)
+ fgc = info->display_fg->vc_num;
+ else
+ fgc = MINOR(current->tty->device)-1;
+
+ /* Does this virtual console belong to the specified fbdev? */
+ if (fb_display[fgc].fb_info != info)
+ return -1;
+
+ return fgc;
 }
 
 
@@ -925,8 +924,9 @@
         return;
 
     cursor_on = 0;
- if (cursor_drawn)
- p->dispsw->revc(p, p->cursor_x, real_y(p, p->cursor_y));
+ if (cursor_drawn && p->cursor_x < conp->vc_cols &&
+ p->cursor_y < conp->vc_rows)
+ p->dispsw->revc(p, p->cursor_x, real_y(p, p->cursor_y));
 
     p->cursor_x = conp->vc_x;
     p->cursor_y = y;

Gr{oetje,eeting}s,

                                                Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 15 2003 - 22:00:43 EST