From: hsimeliere.opensource@witekio.com
To: stable@vger.kernel.org
Cc: Helge Deller <deller@gmx.de>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Hugo SIMELIERE <hsimeliere.opensource@witekio.com>
Subject: [PATCH 4.19 2/2] fbmem: Check virtual screen sizes in fb_set_var()
Date: Thu, 29 Aug 2024 18:14:04 +0200 [thread overview]
Message-ID: <20240829161419.17800-3-hsimeliere.opensource@witekio.com> (raw)
In-Reply-To: <20240829161419.17800-1-hsimeliere.opensource@witekio.com>
From: Helge Deller <deller@gmx.de>
commit 6c11df58fd1ac0aefcb3b227f72769272b939e56 upstream.
Verify that the fbdev or drm driver correctly adjusted the virtual
screen sizes. On failure report the failing driver and reject the screen
size change.
Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: Hugo SIMELIERE <hsimeliere.opensource@witekio.com>
---
drivers/video/fbdev/core/fbmem.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 4449c1fa9f76..114a8c534406 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1006,6 +1006,17 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
if (ret)
goto done;
+ /* verify that virtual resolution >= physical resolution */
+ if (var->xres_virtual < var->xres ||
+ var->yres_virtual < var->yres) {
+ pr_warn("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n",
+ info->fix.id,
+ var->xres_virtual, var->yres_virtual,
+ var->xres, var->yres);
+ ret = -EINVAL;
+ goto done;
+ }
+
if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
struct fb_var_screeninfo old_var;
struct fb_videomode mode;
--
2.43.0
next prev parent reply other threads:[~2024-08-29 16:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 16:14 [PATCH 4.19 0/2] Fix CVE-2021-33655 hsimeliere.opensource
2024-08-29 16:14 ` [PATCH 4.19 1/2] fbcon: Prevent that screen size is smaller than font size hsimeliere.opensource
2024-08-29 16:14 ` hsimeliere.opensource [this message]
2024-08-30 13:01 ` [PATCH 4.19 0/2] Fix CVE-2021-33655 Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240829161419.17800-3-hsimeliere.opensource@witekio.com \
--to=hsimeliere.opensource@witekio.com \
--cc=deller@gmx.de \
--cc=geert@linux-m68k.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox