From: Andrey Strachuk <strochuk@ispras.ru>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: ldv-project@linuxtesting.org,
Andrey Strachuk <strochuk@ispras.ru>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@linux.ie>, Helge Deller <deller@gmx.de>,
linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert@linux-m68k.org>,
dri-devel@lists.freedesktop.org
Subject: [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
Date: Thu, 11 Aug 2022 17:48:50 +0300 [thread overview]
Message-ID: <20220811144850.215377-1-strochuk@ispras.ru> (raw)
Add virtual screen size check to drm_fb_helper_check_var() in
order to validate userspace input.
Found by Linux Verification Center (linuxtesting.org) with syzkaller.
Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
Fixes: 785b93ef8c30 ("drm/kms: move driver specific fb common code to helper functions (v2)")
---
drivers/gpu/drm/drm_fb_helper.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 2d4cee6a10ff..5c8b211769eb 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1355,6 +1355,12 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
(drm_format_info_block_height(fb->format, 0) > 1))
return -EINVAL;
+ /* verify that virtual resolution >= physical resolution */
+ if (var->xres_virtual < var->xres)
+ var->xres_virtual = var->xres;
+ if (var->yres_virtual < var->yres)
+ var->yres_virtual = var->yres;
+
/*
* Changes struct fb_var_screeninfo are currently not pushed back
* to KMS, hence fail if different settings are requested.
--
2.25.1
next reply other threads:[~2022-08-11 14:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 14:48 Andrey Strachuk [this message]
2022-08-11 14:54 ` [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var() Geert Uytterhoeven
2022-08-11 20:59 ` [ldv-project] " Alexey Khoroshilov
2022-09-06 19:54 ` Daniel Vetter
2022-09-07 17:20 ` Alexey Khoroshilov
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=20220811144850.215377-1-strochuk@ispras.ru \
--to=strochuk@ispras.ru \
--cc=airlied@linux.ie \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=tzimmermann@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).