Commit 03e98280 authored by Fullway Wang's avatar Fullway Wang Committed by Jinjiang Tu
Browse files

fbdev: sis: Error out if pixclock equals zero

stable inclusion
from stable-v4.19.308
commit 84246c35ca34207114055a87552a1c4289c8fd7e
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9E2MG
CVE: CVE-2024-26777

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=84246c35ca34207114055a87552a1c4289c8fd7e



--------------------------------

[ Upstream commit e421946be7d9bf545147bea8419ef8239cb7ca52 ]

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 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>
Signed-off-by: default avatarJinjiang Tu <tujinjiang@huawei.com>
parent 1ed85cbd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1488,6 +1488,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) {