diff options
author | Fullway Wang <fullwaywang@outlook.com> | 2024-01-18 09:24:43 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-03-01 15:34:48 +0300 |
commit | 99f1abc34a6dde248d2219d64aa493c76bbdd9eb (patch) | |
tree | 7e8fcca6f5f460bde5c67ee5f1e6da243c910569 /drivers/video/fbdev | |
parent | bc3c2e58d73b28b9a8789fca84778ee165a72d13 (diff) | |
download | linux-99f1abc34a6dde248d2219d64aa493c76bbdd9eb.tar.xz |
fbdev: sis: Error out if pixclock equals zero
[ Upstream commit e421946be7d9bf545147bea8419ef8239cb7ca52 ]
The userspace program could pass any values to the driver through
ioctl() interface. If the driver doesn't check the value of pixclock,
it may cause divide-by-zero error.
In sisfb_check_var(), var->pixclock is used as a divisor to caculate
drate before it is checked against zero. Fix this by checking it
at the beginning.
This is similar to CVE-2022-3061 in i740fb which was fixed by
commit 15cf0b8.
Signed-off-by: Fullway Wang <fullwaywang@outlook.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/sis/sis_main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c index 0f5374f6ef05..6d524a65af18 100644 --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -1475,6 +1475,8 @@ sisfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) vtotal = var->upper_margin + var->lower_margin + var->vsync_len; + if (!var->pixclock) + return -EINVAL; pixclock = var->pixclock; if((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) { |