public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Cc: intel-gfx@lists.freedesktop.org, stable@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/5] drm/core: Fix old_fb handling in drm_mode_atomic_ioctl.
Date: Tue, 17 Nov 2015 10:54:28 +0100	[thread overview]
Message-ID: <20151117095415.GK16848@phenom.ffwll.local> (raw)
In-Reply-To: <1447237751-9663-3-git-send-email-maarten.lankhorst@ubuntu.com>

On Wed, Nov 11, 2015 at 11:29:08AM +0100, Maarten Lankhorst wrote:
> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> 
> plane_mask should be cleared inside the retry loop,
> because it gets reset on every retry.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: stable@vger.kernel.org #v4.3

Nice catch, but a bit a terse commit message. We should add "Without this
fix the plane->fb refcounting might get out of sync on retries, resulting
in either leaked memory or use-after-free." With that:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_atomic.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 7bb3845d9974..0ac31b1ecb67 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1446,7 +1446,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	struct drm_plane *plane;
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *crtc_state;
> -	unsigned plane_mask = 0;
> +	unsigned plane_mask;
>  	int ret = 0;
>  	unsigned int i, j;
>  
> @@ -1486,6 +1486,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
>  
>  retry:
> +	plane_mask = 0;
>  	copied_objs = 0;
>  	copied_props = 0;
>  
> -- 
> 2.1.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-11-17  9:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 10:29 [PATCH 0/5] Atomic core fixes Maarten Lankhorst
2015-11-11 10:29 ` [PATCH 1/5] drm/core: Set legacy_cursor_update in drm_atomic_helper_disable_plane Maarten Lankhorst
2015-11-17  9:51   ` Daniel Vetter
2015-11-11 10:29 ` [PATCH 2/5] drm/core: Fix old_fb handling in drm_mode_atomic_ioctl Maarten Lankhorst
2015-11-17  9:54   ` Daniel Vetter [this message]
2015-11-11 10:29 ` [PATCH 3/5] drm/atomic: add a drm_atomic_clean_old_fb helper Maarten Lankhorst
2015-11-17  9:58   ` Daniel Vetter
2015-11-17 10:55   ` Maarten Lankhorst
2015-11-11 10:29 ` [PATCH 4/5] drm/core: Fix old_fb handling in restore_fbdev_mode_atomic Maarten Lankhorst
2015-11-11 10:29 ` [PATCH 5/5] drm/core: Fix old_fb handling in pan_display_atomic Maarten Lankhorst
2015-11-17  9:58   ` Daniel Vetter
2015-11-17 11:04     ` Jani Nikula

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=20151117095415.GK16848@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@ubuntu.com \
    --cc=stable@vger.kernel.org \
    /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