fbdev: savage: Error out if pixclock equals zero
authorFullway Wang <fullwaywang@outlook.com>
Thu, 18 Jan 2024 03:49:40 +0000 (11:49 +0800)
committerHelge Deller <deller@gmx.de>
Sun, 21 Jan 2024 08:00:14 +0000 (09:00 +0100)
commit04e5eac8f3ab2ff52fa191c187a46d4fdbc1e288
tree80af462962b78bade7861a2f84b644370d89d73d
parentfead90507a37e73d41f6059b325b34412ed8d84b
fbdev: savage: 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.

Although pixclock is checked in savagefb_decode_var(), but it is not
checked properly in savagefb_probe(). Fix this by checking whether
pixclock is zero in the function savagefb_check_var() before
info->var.pixclock is used as the divisor.

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/savage/savagefb_driver.c