mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
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 <harperchen1110@gmail.com> Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
parent
203873a535
commit
92e2a00f29
1 changed files with 2 additions and 0 deletions
|
@ -764,6 +764,8 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var,
|
||||||
int pitch, err = 0;
|
int pitch, err = 0;
|
||||||
|
|
||||||
NVTRACE_ENTER();
|
NVTRACE_ENTER();
|
||||||
|
if (!var->pixclock)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
var->transp.offset = 0;
|
var->transp.offset = 0;
|
||||||
var->transp.length = 0;
|
var->transp.length = 0;
|
||||||
|
|
Loading…
Reference in a new issue