From: Jani Nikula <jani.nikula@linux.intel.com>
To: Arun Iyengar via B4 Relay
<devnull+aiyengar1990.gmail.com@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Arun Iyengar <aiyengar1990@gmail.com>
Subject: Re: [PATCH] drm/debugfs: Accept "reset" with a trailing newline in edid_override
Date: Thu, 12 Nov 2026 13:48:26 +0200 [thread overview]
Message-ID: <eead642a87b1916414972dd346a4be9195020541@intel.com> (raw)
In-Reply-To: <20261112-drm-debugfs-edid-reset-v1-1-4cd19d83cd22@gmail.com>
On Thu, 12 Nov 2026, Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org> wrote:
> From: Arun Iyengar <aiyengar1990@gmail.com>
>
> Writing "reset" to a connector's edid_override debugfs file removes the
> override, but only when exactly those five bytes are written. The
> obvious
>
> echo reset > /sys/kernel/debug/dri/0/HDMI-A-1/edid_override
>
> writes "reset\n", which is handed to drm_edid_override_set() as an EDID
> and rejected with -EINVAL, leaving the override in place. A test
> harness that cleared its override this way kept running on the
> overridden EDID until the next reboot.
>
> Accept a single trailing newline as well. An EDID is at least 128
> bytes, so a six-byte "reset\n" can't be a valid override.
>
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> ---
> Found and tested on an Orange Pi 5 (RK3588S), with this change on a 7.3
> based kernel: with the HDMI connector's own EDID written to
> edid_override, "echo reset > edid_override" succeeds and edid_override
> reads back empty, and "printf reset" (no newline) still succeeds. On
> drm-misc-next the patch is build-tested only (arm64 and x86_64, W=1).
>
> This patch was developed with Claude (Anthropic) as a coding assistant:
> it wrote the code and the commit message, and I reviewed and tested it
> as described above.
> ---
> drivers/gpu/drm/drm_debugfs.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index a72f9723d3a9..3c6290457fa3 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -569,7 +569,12 @@ static ssize_t edid_write(struct file *file, const char __user *ubuf,
> if (IS_ERR(buf))
> return PTR_ERR(buf);
>
> - if (len == 5 && !strncmp(buf, "reset", 5))
> + /*
> + * An EDID is at least 128 bytes, so "reset" with the trailing newline
> + * that "echo reset" adds can't be mistaken for one.
> + */
> + if ((len == 5 || (len == 6 && buf[5] == '\n')) &&
> + !strncmp(buf, "reset", 5))
Feels like a more robust option would be to allocate buf with
memdup_user_nul() and do a simple sysfs_streq() that handles newlines in
a generic fashion.
The corner case downside is that it'll also match "reset\0" followed by
a bunch of arbitrary data, but then an EDID like that wouldn't pass
anyway.
BR,
Jani.
> ret = drm_edid_override_reset(connector);
> else
> ret = drm_edid_override_set(connector, buf, len);
>
> ---
> base-commit: cb0a63f0c96e8ecb90199eeb99cc2a7fcfa703d4
> change-id: 20261110-drm-debugfs-edid-reset-0504a20c67d1
>
> Best regards,
> --
> Arun Iyengar <aiyengar1990@gmail.com>
>
>
--
Jani Nikula, Intel
prev parent reply other threads:[~2026-11-12 11:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 10:44 Arun Iyengar via B4 Relay
2026-11-12 11:48 ` Jani Nikula [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=eead642a87b1916414972dd346a4be9195020541@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=airlied@gmail.com \
--cc=aiyengar1990@gmail.com \
--cc=devnull+aiyengar1990.gmail.com@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--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
all inboxes | Powered by JetHome®