Skip to content

Commit 04e5eac

Browse files
Fullway Wanghdeller
authored andcommitted
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>
1 parent fead905 commit 04e5eac

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/video/fbdev/savage/savagefb_driver.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,9 @@ static int savagefb_check_var(struct fb_var_screeninfo *var,
869869

870870
DBG("savagefb_check_var");
871871

872+
if (!var->pixclock)
873+
return -EINVAL;
874+
872875
var->transp.offset = 0;
873876
var->transp.length = 0;
874877
switch (var->bits_per_pixel) {

0 commit comments

Comments
 (0)