From: Ruben Wauters <rubenru09@aol.com>
To: Tao Yu <tao1.yu@intel.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
syzbot+9ae8e7884e451eaed5b4@syzkaller.appspotmail.com
Subject: Re: [PATCH] drm/gud: validate TV mode names before creating enum property
Date: Sun, 23 Aug 2026 16:57:06 +0100 [thread overview]
Message-ID: <a75ea18f7321a9713d606699f7d80872259c13fd.camel@aol.com> (raw)
In-Reply-To: <20260819072835.4074130-1-tao1.yu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2364 bytes --]
On Wed, 2026-08-19 at 15:28 +0800, Tao Yu wrote:
> The GUD protocol returns TV mode names as fixed-size
> GUD_CONNECTOR_TV_MODE_NAME_LEN entries and requires each name to be
> NUL-terminated.
>
> gud_connector_add_tv_mode() currently passes each fixed-size entry
> directly to drm_mode_create_tv_properties_legacy(), which eventually
> reaches drm_property_add_enum() and strlen(). If a device returns an
> entry without a terminating NUL byte, strlen() reads past the end of
> the slot and can run beyond the allocated buffer, triggering an
> out-of-bounds read.
>
> Validate that each returned TV mode name contains a NUL terminator
> within its fixed-size slot before passing it to the DRM property code.
> If a malformed entry is found, reject the device response with -EIO.
Hello, Thank you for the patch. An earlier patch that fixes this issue
has been merged, however, this does look like a better fix of the
issue, so I will apply this one over the other one, as this does not
truncate the data.
>
> This fixes the out-of-bounds read without changing the handling of
> valid devices, and avoids silently truncating malformed protocol data.
>
> Reported-by: syzbot+9ae8e7884e451eaed5b4@syzkaller.appspotmail.com
> Fixes: 40e1a70b4aed ("drm: Add GUD USB Display driver")
> Signed-off-by: Tao Yu <tao1.yu@intel.com>
Reviewed-by: Ruben Wauters <rubenru09@aol.com>
> ---
> drivers/gpu/drm/gud/gud_connector.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/gud/gud_connector.c b/drivers/gpu/drm/gud/gud_connector.c
> index ea0cca58b7c89..8141c3a1e30ad 100644
> --- a/drivers/gpu/drm/gud/gud_connector.c
> +++ b/drivers/gpu/drm/gud/gud_connector.c
> @@ -396,8 +396,16 @@ static int gud_connector_add_tv_mode(struct gud_device *gdrm, struct drm_connect
> }
>
> num_modes = ret / GUD_CONNECTOR_TV_MODE_NAME_LEN;
> - for (i = 0; i < num_modes; i++)
> - modes[i] = &buf[i * GUD_CONNECTOR_TV_MODE_NAME_LEN];
> + for (i = 0; i < num_modes; i++) {
> + char *mode = &buf[i * GUD_CONNECTOR_TV_MODE_NAME_LEN];
> +
> + if (!memchr(mode, '\0', GUD_CONNECTOR_TV_MODE_NAME_LEN)) {
> + ret = -EIO;
> + goto free;
> + }
> +
> + modes[i] = mode;
> + }
>
> ret = drm_mode_create_tv_properties_legacy(connector->dev, num_modes, modes);
> free:
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]
prev parent reply other threads:[~2026-08-23 15:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 7:28 [PATCH] drm/gud: validate TV mode names before creating enum property Tao Yu
2026-08-23 15:57 ` Ruben Wauters [this message]
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=a75ea18f7321a9713d606699f7d80872259c13fd.camel@aol.com \
--to=rubenru09@aol.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+9ae8e7884e451eaed5b4@syzkaller.appspotmail.com \
--cc=tao1.yu@intel.com \
/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