From: Thierry Reding <treding@nvidia.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: javierm@redhat.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, airlied@gmail.com, simona@ffwll.ch,
rayyan@ansari.sh, dri-devel@lists.freedesktop.org,
sashiko-reviews@lists.linux.dev,
Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH v2 5/6] drm/sysfb: simpledrm: Validate mmap size against framebuffer size
Date: Mon, 22 Jun 2026 18:13:15 +0200 [thread overview]
Message-ID: <ajleu0THc75Ex7uN@orome> (raw)
In-Reply-To: <20260622132433.722823-6-tzimmermann@suse.de>
[-- Attachment #1: Type: text/plain, Size: 2005 bytes --]
On Mon, Jun 22, 2026 at 03:19:39PM +0200, Thomas Zimmermann wrote:
> The size of the mmap'ed framebuffer could be smaller than the minimum
> required framebuffer size. Validate the resource size against the
> framebuffer size.
>
> Buggy firmware that triggers this check should be fixed up with a quirk
> on a case-by-case base.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Suggested-by: Sashiko <sashiko-bot@kernel.org>
> ---
> drivers/gpu/drm/sysfb/simpledrm.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
> index 76b9a3f5c4ef..a04f0c852ea4 100644
> --- a/drivers/gpu/drm/sysfb/simpledrm.c
> +++ b/drivers/gpu/drm/sysfb/simpledrm.c
> @@ -6,6 +6,7 @@
> #include <linux/of_address.h>
> #include <linux/of_clk.h>
> #include <linux/of_reserved_mem.h>
> +#include <linux/overflow.h>
> #include <linux/platform_data/simplefb.h>
> #include <linux/platform_device.h>
> #include <linux/pm.h>
> @@ -624,6 +625,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
> u16 width_mm = 0, height_mm = 0;
> struct device_node *panel_node;
> const struct drm_format_info *format;
> + u64 size;
> struct resource *res, *mem = NULL;
> struct drm_plane *primary_plane;
> struct drm_crtc *crtc;
> @@ -704,6 +706,15 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
> }
> stride = pitch;
> }
> + if (check_mul_overflow(height, stride, &size)) {
> + drm_err(dev, "framebuffer size exceeds maximum\n");
> + return ERR_PTR(-EINVAL);
> + }
> + size = ALIGN(size, PAGE_SIZE);
> + if (size < PAGE_SIZE) {
> + drm_err(dev, "framebuffer alignment exceeds maximum\n");
That error message doesn't make sense to me. Maybe "framebuffer
alignment below minimum", or something along those lines?
With that fixed:
Reviewed-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-06-22 16:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 13:19 [PATCH v2 0/6] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
2026-06-22 13:19 ` [PATCH v2 1/6] drm/sysfb: simpledrm: Improve framebuffer-size validation Thomas Zimmermann
2026-06-22 13:39 ` sashiko-bot
2026-06-22 15:36 ` Thierry Reding
2026-06-22 13:19 ` [PATCH v2 2/6] drm/sysfb: simpledrm: Improve panel-size validation Thomas Zimmermann
2026-06-22 16:05 ` Thierry Reding
2026-06-23 8:51 ` Thomas Zimmermann
2026-06-22 13:19 ` [PATCH v2 3/6] drm/sysfb: simpledrm: Inline simplefb_get_validated_int() Thomas Zimmermann
2026-06-22 16:06 ` Thierry Reding
2026-06-22 13:19 ` [PATCH v2 4/6] drm/sysfb: simpledrm: Improve stride validation Thomas Zimmermann
2026-06-22 16:10 ` Thierry Reding
2026-06-23 8:56 ` Thomas Zimmermann
2026-06-22 13:19 ` [PATCH v2 5/6] drm/sysfb: simpledrm: Validate mmap size against framebuffer size Thomas Zimmermann
2026-06-22 13:33 ` sashiko-bot
2026-06-22 13:47 ` Thomas Zimmermann
2026-06-22 16:13 ` Thierry Reding [this message]
2026-06-23 9:02 ` Thomas Zimmermann
2026-06-23 13:40 ` Thierry Reding
2026-06-22 13:19 ` [PATCH v2 6/6] drm/sysfb: simpledrm: Read panel orientation from DT node Thomas Zimmermann
2026-06-22 13:34 ` sashiko-bot
2026-06-22 16:17 ` Thierry Reding
2026-06-23 9:04 ` Thomas Zimmermann
2026-06-23 13:43 ` Thierry Reding
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=ajleu0THc75Ex7uN@orome \
--to=treding@nvidia.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=rayyan@ansari.sh \
--cc=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
--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