linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbdev: Fix crash if fb_set_var() called before register_framebuffer()
@ 2004-11-24 17:15 Antonino A. Daplas
  2004-11-26 22:38 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Antonino A. Daplas @ 2004-11-24 17:15 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds; +Cc: Linux Fbdev development list, linux-kernel

The field info->modelist is initialized during register_framebuffer.  This
field is also referred to in fb_set_var().  Thus a call to fb_set_var()
before register_framebuffer() will cause a crash.  A few drivers do this,
notably controlfb.  (This might fix reports of controlfb crashing in
powermacs).

Signed-off-by: Antonino Daplas <adaplas@pol.net>
---

 fbmem.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -Nru a/drivers/video/fbmem.c b/drivers/video/fbmem.c
--- a/drivers/video/fbmem.c	2004-11-23 21:20:13 +08:00
+++ b/drivers/video/fbmem.c	2004-11-25 01:09:22 +08:00
@@ -725,7 +725,10 @@
 			fb_set_cmap(&info->cmap, info);
 
 			fb_var_to_videomode(&mode, &info->var);
-			fb_add_videomode(&mode, &info->modelist);
+
+			if (info->modelist.prev && info->modelist.next &&
+			    !list_empty(&info->modelist))
+				fb_add_videomode(&mode, &info->modelist);
 
 			if (info->flags & FBINFO_MISC_MODECHANGEUSER) {
 				struct fb_event event;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-11-27  4:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-24 17:15 [PATCH] fbdev: Fix crash if fb_set_var() called before register_framebuffer() Antonino A. Daplas
2004-11-26 22:38 ` Benjamin Herrenschmidt
2004-11-27  2:56   ` Antonino A. Daplas
2004-11-27  4:15     ` Benjamin Herrenschmidt
2004-11-27  4:43       ` Antonino A. Daplas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).