Patch "fbdev: nvidia: Fix potential divide by zero" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fbdev: nvidia: Fix potential divide by zero

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fbdev-nvidia-fix-potential-divide-by-zero.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8bd68366c0c39507b275f489dceb54360df661f2
Author: Wei Chen <harperchen1110@xxxxxxxxx>
Date:   Wed Mar 15 07:18:31 2023 +0000

    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@xxxxxxxxx>
    Signed-off-by: Helge Deller <deller@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/video/fbdev/nvidia/nvidia.c b/drivers/video/fbdev/nvidia/nvidia.c
index a372a183c1f01..f9c388a8c10e3 100644
--- a/drivers/video/fbdev/nvidia/nvidia.c
+++ b/drivers/video/fbdev/nvidia/nvidia.c
@@ -763,6 +763,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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux