Skip to contentSkip to conversation

fbdev: udlfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO

PATCH Applied Greg Kroah-Hartman 2 participants 2 messages Apr 9 – Apr 10

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbdev: udlfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO

Much like commit 19f953e74356 ("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 59277b679f8b ("Staging: udlfb: add dynamic modeset support")
Assisted-by gregkh_clanker_t1000
---
 drivers/video/fbdev/udlfb.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/fbdev/udlfb.c +3 -0
index 3c6a9b5758d9..c341d76bc564 100644
@@ -1018,6 +1018,9 @@ static int dlfb_ops_check_var(struct fb_var_screeninfo *var,
 	struct fb_videomode mode;
 	struct dlfb_data *dlfb = info->par;
 
+	if (!var->pixclock)
+		return -EINVAL;
+
 	/* set device-specific elements of var unrelated to mode */
 	dlfb_var_color_format(var);
 
Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Greg Kroah-Hartman

Much like commit 19f953e74356 ("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.

Quoted 8 lines
Cc Bernie Thompson <[email protected]>
Cc Helge Deller <[email protected]>
Fixes 59277b679f8b ("Staging: udlfb: add dynamic modeset support")
Assisted-by gregkh_clanker_t1000
---
  drivers/video/fbdev/udlfb.c | 3 +++
  1 file changed, 3 insertions(+)applied.

applied.

Thanks!
Helge