diff options
author | Wei Chen | 2023-03-15 08:33:47 +0000 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-04-06 12:10:41 +0200 |
commit | 8ab9eada22d93fa501072161ceedbd6d61bc8df7 (patch) | |
tree | a3d116c0b2ba38b9d22388533436322310c88515 /drivers/video/fbdev | |
parent | c8d88107971e13e65575885e42ce1908b0d6799e (diff) |
fbdev: intelfb: Fix potential divide by zero
[ Upstream commit d823685486a3446d061fed7c7d2f80af984f119a ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/video/fbdev')
-rw-r--r-- | drivers/video/fbdev/intelfb/intelfbdrv.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/video/fbdev/intelfb/intelfbdrv.c b/drivers/video/fbdev/intelfb/intelfbdrv.c index d4a2891a9a7a..a93dd531d00d 100644 --- a/drivers/video/fbdev/intelfb/intelfbdrv.c +++ b/drivers/video/fbdev/intelfb/intelfbdrv.c @@ -1219,6 +1219,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; |