Commit 8c46a631 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbdev: Fix crash if fb_set_var() called before register_framebuffer()

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: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 18b98872
...@@ -725,7 +725,10 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) ...@@ -725,7 +725,10 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
fb_set_cmap(&info->cmap, info); fb_set_cmap(&info->cmap, info);
fb_var_to_videomode(&mode, &info->var); 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) { if (info->flags & FBINFO_MISC_MODECHANGEUSER) {
struct fb_event event; struct fb_event event;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment