From: "Antonino A. Daplas" <adaplas@hotpop.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Linux Fbdev development list
<linux-fbdev-devel@lists.sourceforge.net>
Subject: [PATCH 1/8] fbcon: Do not touch hardware if vc_mode != KD_TEXT
Date: Tue, 2 Nov 2004 19:46:06 +0800 [thread overview]
Message-ID: <200411021946.06302.adaplas@hotpop.com> (raw)
The frambuffer console is still writing to the graphics hardware even if the
hardware is not owned anymore by the console. This can lead to crashes with
some hardware.
A trace of the source indicates that it comes from almost anywhere, anytime.
The fix is to return immediately if vc_mode != KD_TEXT. The test is placed in
the following functions if not already present.
fbcon_cursor()
fbcon_putcs()
fbcon_clear()
fbcon_bmove()
fbcon_blank()
Tony
Signed-off-by: Antonino Daplas <adaplas@pol.net>
fbcon.c | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
diff -Nru a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
--- a/drivers/video/console/fbcon.c 2004-10-30 19:10:42 +08:00
+++ b/drivers/video/console/fbcon.c 2004-11-02 18:58:15 +08:00
@@ -983,6 +983,9 @@
if (info->state != FBINFO_STATE_RUNNING)
return;
+ if (vt_cons[vc->vc_num]->vc_mode != KD_TEXT)
+ return;
+
if (!height || !width)
return;
@@ -1007,6 +1010,7 @@
if (!info->fbops->fb_blank && console_blanked)
return;
+
if (info->state != FBINFO_STATE_RUNNING)
return;
@@ -1042,6 +1046,9 @@
int y = real_y(p, vc->vc_y);
int c = scr_readw((u16 *) vc->vc_pos);
+ if (vt_cons[vc->vc_num]->vc_mode != KD_TEXT)
+ return;
+
ops->cursor_flash = 1;
if (mode & CM_SOFTBACK) {
mode &= ~CM_SOFTBACK;
@@ -1690,6 +1697,9 @@
if (!info->fbops->fb_blank && console_blanked)
return;
+ if (vt_cons[vc->vc_num]->vc_mode != KD_TEXT)
+ return;
+
if (!width || !height)
return;
@@ -1952,6 +1962,7 @@
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par;
struct display *p = &fb_display[vc->vc_num];
+ int retval = 0;
if (mode_switch) {
struct fb_var_screeninfo var = info->var;
@@ -1968,19 +1979,16 @@
if (info->flags & FBINFO_MISC_MODESWITCHLATE)
info->flags |= FBINFO_MISC_MODESWITCH;
- if (blank) {
- fbcon_cursor(vc, CM_ERASE);
- return 0;
- }
-
- if (!(info->flags & FBINFO_MISC_MODESWITCHLATE)) {
+ if (!blank && !(info->flags & FBINFO_MISC_MODESWITCHLATE)) {
var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
fb_set_var(info, &var);
}
+
+ return 0;
}
- fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
ops->cursor_flash = (!blank);
+ fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
if (!info->fbops->fb_blank) {
if (blank) {
@@ -2001,9 +2009,10 @@
vc->vc_video_erase_char = oldc;
} else
update_screen(vc->vc_num);
- return 0;
- } else
- return fb_blank(info, blank);
+ } else if (vt_cons[vc->vc_num]->vc_mode == KD_TEXT)
+ retval = fb_blank(info, blank);
+
+ return retval;
}
static void fbcon_free_font(struct display *p)
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
next reply other threads:[~2004-11-02 11:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-02 11:46 Antonino A. Daplas [this message]
2004-11-02 22:27 ` [PATCH 1/8] fbcon: Do not touch hardware if vc_mode != KD_TEXT Benjamin Herrenschmidt
2004-11-02 23:27 ` Antonino A. Daplas
2004-11-03 2:30 ` Antonino A. Daplas
2004-11-03 23:52 ` Andrew Morton
2004-11-04 0:16 ` Benjamin Herrenschmidt
2004-11-04 0:57 ` Antonino A. Daplas
2004-11-04 0:58 ` Antonino A. Daplas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200411021946.06302.adaplas@hotpop.com \
--to=adaplas@hotpop.com \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.