Skip to content

Commit

Permalink
fbdev: save the activate field before calling fb_check_var()
Browse files Browse the repository at this point in the history
Some drivers may reset the var->activate field on fb_check_var(). This can
lead to undefined behavior. For example, doing fbset -a <option> with vga16fb
will only modify the active console instead of modifying all.

Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed May 8, 2007
1 parent 38b4982 commit 4941cb7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/video/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,8 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)

if ((var->activate & FB_ACTIVATE_FORCE) ||
memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) {
u32 activate = var->activate;

if (!info->fbops->fb_check_var) {
*var = info->var;
return 0;
Expand Down Expand Up @@ -831,7 +833,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)

if (!err && (flags & FBINFO_MISC_USEREVENT)) {
struct fb_event event;
int evnt = (var->activate & FB_ACTIVATE_ALL) ?
int evnt = (activate & FB_ACTIVATE_ALL) ?
FB_EVENT_MODE_CHANGE_ALL :
FB_EVENT_MODE_CHANGE;

Expand Down

0 comments on commit 4941cb7

Please sign in to comment.