]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fbdev: tdfxfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Apr 2026 13:23:14 +0000 (15:23 +0200)
committerHelge Deller <deller@gmx.de>
Fri, 10 Apr 2026 14:54:35 +0000 (16:54 +0200)
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 <deller@gmx.de>
Assisted-by: gregkh_clanker_t1000
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/tdfxfb.c

index 7606e024fa3f4c7d783f5c18d537255f820a3d4c..4c4e53aaea3ad7050827f802d4300260f18d1aa1 100644 (file)
@@ -497,6 +497,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));