Skip to content

Commit a31e451

Browse files
gregkhhdeller
authored andcommitted
fbdev: udlfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
Much like commit 19f953e ("fbdev: fb_pm2fb: Avoid potential divide by zero error"), we also need to prevent that same crash from happening in the udlfb driver as it uses pixclock directly when dividing, which will crash. Cc: Bernie Thompson <[email protected]> Cc: Helge Deller <[email protected]> Fixes: 59277b6 ("Staging: udlfb: add dynamic modeset support") Assisted-by: gregkh_clanker_t1000 Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 8f98b81 commit a31e451

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/video/fbdev/udlfb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,9 @@ static int dlfb_ops_check_var(struct fb_var_screeninfo *var,
10181018
struct fb_videomode mode;
10191019
struct dlfb_data *dlfb = info->par;
10201020

1021+
if (!var->pixclock)
1022+
return -EINVAL;
1023+
10211024
/* set device-specific elements of var unrelated to mode */
10221025
dlfb_var_color_format(var);
10231026

0 commit comments

Comments
 (0)