[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1630294223-7225-1-git-send-email-tcs_kernel@tencent.com>
Date: Mon, 30 Aug 2021 11:30:23 +0800
From: tcs.kernel@...il.com
To: daniel.vetter@...ll.ch, willy@...radead.org,
george.kennedy@...cle.com, dri-devel@...ts.freedesktop.org,
linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org,
arnd@...db.de, gregkh@...uxfoundation.org,
penguin-kernel@...ove.SAKURA.ne.jp
Cc: Haimin Zhang <tcs_kernel@...cent.com>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Subject: [PATCH V4] fbcon: fix fbcon out-of-bounds write in sys_imageblit
From: Haimin Zhang <tcs_kernel@...cent.com>
yres and vyres can be controlled by user mode parameters, and cause
p->vrows to become a negative value. While this value be passed to real_y
function, the ypos will be out of screen range.This is an out-of-bounds
write bug.
some driver will check xres and yres in fb_check_var callback,but some not
so we add a common check after that callback.
Signed-off-by: Haimin Zhang <tcs_kernel@...cent.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
---
drivers/video/fbdev/core/fbmem.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 1c85514..5599372 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1013,6 +1013,10 @@ static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var,
if (ret)
return ret;
+ /* virtual resolution cannot be smaller than visible resolution. */
+ if (var->yres_virtual < var->yres || var->xres_virtual < var->xres)
+ return -EINVAL;
+
if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW)
return 0;
--
1.8.3.1
Powered by blists - more mailing lists