summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorWei Chen <harperchen1110@gmail.com>2023-03-15 08:33:47 +0000
committerHelge Deller <deller@gmx.de>2023-03-16 16:18:16 +0100
commitd823685486a3446d061fed7c7d2f80af984f119a (patch)
tree8cb44ddb2b1532c2a9c40d4b32929a83b383a26e /drivers/video
parent92e2a00f2987483e1f9253625828622edd442e61 (diff)
downloadlinux-stable-d823685486a3446d061fed7c7d2f80af984f119a.tar.gz
linux-stable-d823685486a3446d061fed7c7d2f80af984f119a.tar.bz2
linux-stable-d823685486a3446d061fed7c7d2f80af984f119a.zip
fbdev: intelfb: Fix potential divide by zero
Variable var->pixclock is controlled by user and can be assigned to zero. Without proper check, divide by zero would occur in intelfbhw_validate_mode and intelfbhw_mode_to_hw. Error out if var->pixclock is zero. Signed-off-by: Wei Chen <harperchen1110@gmail.com> Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/intelfb/intelfbdrv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/video/fbdev/intelfb/intelfbdrv.c b/drivers/video/fbdev/intelfb/intelfbdrv.c
index 0a9e5067b201..a81095b2b1ea 100644
--- a/drivers/video/fbdev/intelfb/intelfbdrv.c
+++ b/drivers/video/fbdev/intelfb/intelfbdrv.c
@@ -1222,6 +1222,9 @@ static int intelfb_check_var(struct fb_var_screeninfo *var,
dinfo = GET_DINFO(info);
+ if (!var->pixclock)
+ return -EINVAL;
+
/* update the pitch */
if (intelfbhw_validate_mode(dinfo, var) != 0)
return -EINVAL;