Skip to content
Snippets Groups Projects
Commit 512ee6d6 authored by Fullway Wang's avatar Fullway Wang Committed by Greg Kroah-Hartman
Browse files

fbdev: savage: Error out if pixclock equals zero


[ Upstream commit 04e5eac8 ]

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 15cf0b82.

Signed-off-by: default avatarFullway Wang <fullwaywang@outlook.com>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5ffab99e
No related branches found
No related tags found
No related merge requests found
......@@ -868,6 +868,9 @@ static int savagefb_check_var(struct fb_var_screeninfo *var,
DBG("savagefb_check_var");
if (!var->pixclock)
return -EINVAL;
var->transp.offset = 0;
var->transp.length = 0;
switch (var->bits_per_pixel) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment