All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ying Liu <gnuiyl@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Daniel Stone <daniels@collabora.com>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] Revert "drm: Unify handling of blob and object properties"
Date: Wed, 7 Sep 2016 17:56:25 +0800	[thread overview]
Message-ID: <CAOcKUNX0xqT2c1_LN7LBTNabx15xf71a=W=6xMF6owmHoJ1WhQ@mail.gmail.com> (raw)
In-Reply-To: <8c0d3482-1bb5-6a15-b105-6bda2b31b5dc@linux.intel.com>

On Wed, Sep 7, 2016 at 5:52 PM, Maarten Lankhorst
<maarten.lankhorst@linux.intel.com> wrote:
> This reverts commit 77953bd136d2a70bca2dc93b3ccda07a2b37076f.
>
> This causes a kernel panic when trying to assign a blob to a property,
> and has obviously never been tested.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Tested-by: Liu Ying <gnuiyl@gmail.com>

> ---
>  drivers/gpu/drm/drm_property.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> index 4139afbcc267..a4d81cf4ffa0 100644
> --- a/drivers/gpu/drm/drm_property.c
> +++ b/drivers/gpu/drm/drm_property.c
> @@ -870,8 +870,20 @@ bool drm_property_change_valid_get(struct drm_property *property,
>                 for (i = 0; i < property->num_values; i++)
>                         valid_mask |= (1ULL << property->values[i]);
>                 return !(value & ~valid_mask);
> -       } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB) ||
> -                  drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
> +       } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
> +               struct drm_property_blob *blob;
> +
> +               if (value == 0)
> +                       return true;
> +
> +               blob = drm_property_lookup_blob(property->dev, value);
> +               if (blob) {
> +                       *ref = &blob->base;
> +                       return true;
> +               } else {
> +                       return false;
> +               }
> +       } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
>                 /* a zero value for an object property translates to null: */
>                 if (value == 0)
>                         return true;
> @@ -888,12 +900,13 @@ bool drm_property_change_valid_get(struct drm_property *property,
>  }
>
>  void drm_property_change_valid_put(struct drm_property *property,
> -                                  struct drm_mode_object *ref)
> +               struct drm_mode_object *ref)
>  {
>         if (!ref)
>                 return;
>
> -       if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT) ||
> -           drm_property_type_is(property, DRM_MODE_PROP_BLOB))
> +       if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
>                 drm_mode_object_unreference(ref);
> +       } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))
> +               drm_property_unreference_blob(obj_to_blob(ref));
>  }
> --
> 2.7.4
>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-09-07  9:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29  8:27 [PATCH 1/9] drm: Extract drm_encoder.[hc] Daniel Vetter
2016-08-29  8:27 ` [PATCH 2/9] drm/doc: Polish kerneldoc for encoders Daniel Vetter
2016-09-15  4:47   ` [2/9] " Pandiyan, Dhinakaran
2016-08-29  8:27 ` [PATCH 3/9] drm: Extract drm_mode_object.[hc] Daniel Vetter
2016-08-29  8:27 ` [PATCH 4/9] drm: Remove drm_mode_object->atomic_count Daniel Vetter
2016-08-29  8:27 ` [PATCH 5/9] drm/doc: Polish docs for drm_mode_object Daniel Vetter
2016-08-29  8:27 ` [PATCH 6/9] drm: move drm_mode_legacy_fb_format to drm_fourcc.c Daniel Vetter
2016-08-29  8:27 ` [PATCH 7/9] drm: Extract drm_property.[hc] Daniel Vetter
2016-08-29  8:27 ` [PATCH 8/9] drm: Unify handling of blob and object properties Daniel Vetter
2016-09-06  9:22   ` Ying Liu
2016-09-07  9:52     ` [PATCH] Revert "drm: Unify handling of blob and object properties" Maarten Lankhorst
2016-09-07  9:56       ` Ying Liu [this message]
2016-09-07 11:25         ` Jani Nikula
2016-08-29  8:27 ` [PATCH 9/9] drm/doc: Polish docs for drm_property&drm_property_blob Daniel Vetter
2016-08-29 13:14   ` Archit Taneja
2016-08-29 14:04     ` Daniel Vetter

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='CAOcKUNX0xqT2c1_LN7LBTNabx15xf71a=W=6xMF6owmHoJ1WhQ@mail.gmail.com' \
    --to=gnuiyl@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.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.