]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Apr 2026 11:30:45 +0000 (13:30 +0200)
commit 8f98b81fe011e1879e6a7b1247e69e06a5e17af2 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/video/fbdev/tdfxfb.c

index 51ebe78359ec34e4aff34a29d60275131966adb3..531fb8478e207144fc5b8b7e7efad9dc9743e316 100644 (file)
@@ -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));