Patch "fbdev: tgafb: Fix potential divide by zero" has been added to the 6.1-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: tgafb: Fix potential divide by zero

to the 6.1-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-tgafb-fix-potential-divide-by-zero.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 30951bb7f4be88accaf8ecb3d8cb716402cf8c19
Author: Wei Chen <harperchen1110@xxxxxxxxx>
Date:   Tue Mar 7 13:08:56 2023 +0000

    fbdev: tgafb: Fix potential divide by zero
    
    [ Upstream commit f90bd245de82c095187d8c2cabb8b488a39eaecc ]
    
    fb_set_var would by called when user invokes ioctl with cmd
    FBIOPUT_VSCREENINFO. User-provided data would finally reach
    tgafb_check_var. In case var->pixclock is assigned to zero,
    divide by zero would occur when checking whether reciprocal
    of var->pixclock is too high.
    
    Similar crashes have happened in other fbdev drivers. There
    is no check and modification on var->pixclock along the call
    chain to tgafb_check_var. We believe it could also be triggered
    in driver tgafb 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/tgafb.c b/drivers/video/fbdev/tgafb.c
index 251dbd282f5ed..84d5daef97666 100644
--- a/drivers/video/fbdev/tgafb.c
+++ b/drivers/video/fbdev/tgafb.c
@@ -173,6 +173,9 @@ tgafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
 	struct tga_par *par = (struct tga_par *)info->par;
 
+	if (!var->pixclock)
+		return -EINVAL;
+
 	if (par->tga_type == TGA_TYPE_8PLANE) {
 		if (var->bits_per_pixel != 8)
 			return -EINVAL;



[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