mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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>
This commit is contained in:
parent
04e5eac8f3
commit
e421946be7
1 changed files with 2 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue