diff options
author | Wei Chen <harperchen1110@gmail.com> | 2023-03-15 10:18:31 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-04-06 13:10:41 +0300 |
commit | c8d88107971e13e65575885e42ce1908b0d6799e (patch) | |
tree | 59b1dc8f23c38b1c927c022106f7477f7d7bae78 /drivers/video | |
parent | 35a32a50dc8f36dd3a0f4c7510997ecc029be586 (diff) | |
download | linux-c8d88107971e13e65575885e42ce1908b0d6799e.tar.xz |
fbdev: nvidia: Fix potential divide by zero
[ Upstream commit 92e2a00f2987483e1f9253625828622edd442e61 ]
variable var->pixclock can be set by user. In case it
equals to zero, divide by zero would occur in nvidiafb_set_par.
Similar crashes have happened in other fbdev drivers. There
is no check and modification on var->pixclock along the call
chain to nvidia_check_var and nvidiafb_set_par. We believe it
could also be triggered in driver nvidia 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>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/nvidia/nvidia.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/video/fbdev/nvidia/nvidia.c b/drivers/video/fbdev/nvidia/nvidia.c index a6c3bc222246..1b8904824ad8 100644 --- a/drivers/video/fbdev/nvidia/nvidia.c +++ b/drivers/video/fbdev/nvidia/nvidia.c @@ -764,6 +764,8 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var, int pitch, err = 0; NVTRACE_ENTER(); + if (!var->pixclock) + return -EINVAL; var->transp.offset = 0; var->transp.length = 0; |