]> git.baikalelectronics.ru Git - kernel.git/commit
fbdev: tgafb: Fix potential divide by zero
authorWei Chen <harperchen1110@gmail.com>
Tue, 7 Mar 2023 13:08:56 +0000 (13:08 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Apr 2023 09:16:42 +0000 (11:16 +0200)
commit33985ac0da63964840e2f11872276b03a26d9792
treeb93fffe4ce6730fe37b3c9771e54ea99c9a31c9c
parentd9a80965efeb3dc08e7100e49913185c6ba62ee6
fbdev: tgafb: Fix potential divide by zero

[ Upstream commit f90bd245de82c095187d8c2cabb8b488a39eaecc ]

fb_set_var would by called when user invokes ioctl with cmd
FBIOPUT_VSCREENINFO. User-provided data would finally reach
tgafb_check_var. In case var->pixclock is assigned to zero,
divide by zero would occur when checking whether reciprocal
of var->pixclock is too high.

Similar crashes have happened in other fbdev drivers. There
is no check and modification on var->pixclock along the call
chain to tgafb_check_var. We believe it could also be triggered
in driver tgafb from user site.

Signed-off-by: Wei Chen <harperchen1110@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/video/fbdev/tgafb.c