fbdev: sis: Error out if pixclock equals zero
authorFullway Wang <fullwaywang@outlook.com>
Thu, 18 Jan 2024 06:24:43 +0000 (14:24 +0800)
committerHelge Deller <deller@gmx.de>
Sun, 21 Jan 2024 08:00:14 +0000 (09:00 +0100)
commite421946be7d9bf545147bea8419ef8239cb7ca52
tree281edc1f9f7a2086646371bd19275443b19273e2
parent04e5eac8f3ab2ff52fa191c187a46d4fdbc1e288
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>
drivers/video/fbdev/sis/sis_main.c