Commit 92e2a00f authored by Wei Chen's avatar Wei Chen Committed by Helge Deller

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: default avatarWei Chen <harperchen1110@gmail.com>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent 203873a5
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment