summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorFullway Wang <fullwaywang@outlook.com>2024-01-18 14:24:43 +0800
committerHelge Deller <deller@gmx.de>2024-01-21 09:00:14 +0100
commite421946be7d9bf545147bea8419ef8239cb7ca52 (patch)
tree281edc1f9f7a2086646371bd19275443b19273e2 /drivers/video
parent04e5eac8f3ab2ff52fa191c187a46d4fdbc1e288 (diff)
downloadlinux-e421946be7d9bf545147bea8419ef8239cb7ca52.tar.gz
linux-e421946be7d9bf545147bea8419ef8239cb7ca52.tar.bz2
linux-e421946be7d9bf545147bea8419ef8239cb7ca52.zip
fbdev: sis: Error out if pixclock equals zero
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>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/sis/sis_main.c2
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 803ccb6aa479..009bf1d92644 100644
--- a/drivers/video/fbdev/sis/sis_main.c
+++ b/drivers/video/fbdev/sis/sis_main.c
@@ -1444,6 +1444,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) {