All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Thomas Wood <thomas.wood@intel.com>,
	Maling list - DRI developers <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH v2 2/2] drm/debugfs: add an "edid_override" file per connector
Date: Wed, 18 Jun 2014 22:08:07 +0200	[thread overview]
Message-ID: <20140618200807.GV5821@phenom.ffwll.local> (raw)
In-Reply-To: <CADnq5_Nioga9SfJqcHzqWvSApibUd=Sr6eE9s+GTnkbPWW+nnA@mail.gmail.com>

On Wed, Jun 18, 2014 at 03:37:30PM -0400, Alex Deucher wrote:
> On Wed, Jun 18, 2014 at 12:52 PM, Thomas Wood <thomas.wood@intel.com> wrote:
> > +static ssize_t edid_write(struct file *file, const char __user *ubuf,
> > +                         size_t len, loff_t *offp)
> > +{
> > +       struct seq_file *m = file->private_data;
> > +       struct drm_connector *connector = m->private;
> > +       char *buf;
> > +       struct edid *edid;
> > +       int ret;
> > +
> > +       buf = memdup_user(ubuf, len);
> > +       if (IS_ERR(buf))
> > +               return PTR_ERR(buf);
> > +
> > +       edid = (struct edid *) buf;
> > +
> > +       if (len == 5 && !strncmp(buf, "reset", 5)) {
> > +               connector->override_edid = false;
> > +               ret = drm_mode_connector_update_edid_property(connector, NULL);
> > +       } else if (len < EDID_LENGTH ||
> > +                  EDID_LENGTH * (1 + edid->extensions) > len)
> > +               ret = -EINVAL;
> > +       else {
> > +               connector->override_edid = false;
> 
> Might be worth doing some minimal validation of the EDID (e.g., make
> sure it has a valid header).

Actually we also have plans to abuse this for a bit of nasty EDID
injection to exercise our parser. So at most we should do just enough
checking to make sure the claimed edid length field agrees with the edid
itself (which we have), but beyond that any kind of garbage should be
allowed imo.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-06-18 20:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29 15:57 [PATCH 0/3] connector debugfs properties Thomas Wood
2014-05-29 15:57 ` [PATCH 1/3] drm: add register and unregister functions for connectors Thomas Wood
2014-06-10 16:21   ` David Herrmann
2014-06-19  6:57     ` Daniel Vetter
2014-05-29 15:57 ` [PATCH 2/3] drm/debugfs: add a "force" file per connector Thomas Wood
2014-06-10 16:36   ` David Herrmann
2014-06-18 16:52   ` [PATCH v2 0/2] connector debugfs properties Thomas Wood
2014-06-18 16:52     ` [PATCH v2 1/2] drm/debugfs: add a "force" file per connector Thomas Wood
2014-06-18 20:11       ` Alex Deucher
2014-06-18 16:52     ` [PATCH v2 2/2] drm/debugfs: add an "edid_override" " Thomas Wood
2014-06-18 19:37       ` Alex Deucher
2014-06-18 20:08         ` Daniel Vetter [this message]
2014-05-29 15:57 ` [PATCH 3/3] " Thomas Wood
2014-06-10 16:58   ` David Herrmann

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=20140618200807.GV5821@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=alexdeucher@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thomas.wood@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.