Skip to content

Commit 92e2a00

Browse files
harperchenhdeller
authored andcommitted
fbdev: nvidia: Fix potential divide by zero
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 <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 203873a commit 92e2a00

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/video/fbdev/nvidia/nvidia.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var,
764764
int pitch, err = 0;
765765

766766
NVTRACE_ENTER();
767+
if (!var->pixclock)
768+
return -EINVAL;
767769

768770
var->transp.offset = 0;
769771
var->transp.length = 0;

0 commit comments

Comments
 (0)