Skip to contentSkip to conversation

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

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbdev: tdfxfb: 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 Helge Deller <[email protected]>
Assisted-by gregkh_clanker_t1000
Cc stable <[email protected]>
---
 drivers/video/fbdev/tdfxfb.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/fbdev/tdfxfb.c +3 -0
index 51ebe78359ec..531fb8478e20 100644
@@ -496,6 +496,9 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 		}
 	}
 
+	if (!var->pixclock)
+		return -EINVAL;
+
 	if (PICOS2KHZ(var->pixclock) > par->max_pixclock) {
 		DPRINTK("pixclock too high (%ldKHz)\n",
 			PICOS2KHZ(var->pixclock));
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 7 lines
Cc Helge Deller <[email protected]>
Assisted-by gregkh_clanker_t1000
Cc stable <[email protected]>
---
  drivers/video/fbdev/tdfxfb.c | 3 +++
  1 file changed, 3 insertions(+)

applied.

Thanks!
Helge