diff mbox

drm/i915: use i915_gem_object_put_unlocked() after releasing mutex

Message ID 1469120283-13510-1-git-send-email-david.s.gordon@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Gordon July 21, 2016, 4:58 p.m. UTC
The exit path in intel_overlay_put_image_ioctl() first unlocks the
struct_mutex, then drops its reference to 'new_bo' by calling
i915_gem_object_put(). As it isn't holding the mutex at this point,
this should be i915_gem_object_put_unlocked().

This was previously correct but got splatted in the recent
s/drm_gem_object_unreference/i915_gem_object_put/
where the _unlocked suffix was lost in this one case.

Also fixes a whitespace glitch introduced in the same commit.

Fixes: f8c417cd drm/i915: Rename drm_gem_object_unreference in preparation ...
Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 3 +--
 drivers/gpu/drm/i915/intel_overlay.c  | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Chris Wilson July 21, 2016, 5:25 p.m. UTC | #1
On Thu, Jul 21, 2016 at 05:58:03PM +0100, Dave Gordon wrote:
> The exit path in intel_overlay_put_image_ioctl() first unlocks the
> struct_mutex, then drops its reference to 'new_bo' by calling
> i915_gem_object_put(). As it isn't holding the mutex at this point,
> this should be i915_gem_object_put_unlocked().
> 
> This was previously correct but got splatted in the recent
> s/drm_gem_object_unreference/i915_gem_object_put/
> where the _unlocked suffix was lost in this one case.
> 
> Also fixes a whitespace glitch introduced in the same commit.

The glitch was already there.
 
> Fixes: f8c417cd drm/i915: Rename drm_gem_object_unreference in preparation ...
> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_gem_evict.c | 3 +--
>  drivers/gpu/drm/i915/intel_overlay.c  | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
> index 81f7b43..6e09e11 100644
> --- a/drivers/gpu/drm/i915/i915_gem_evict.c
> +++ b/drivers/gpu/drm/i915/i915_gem_evict.c
> @@ -196,8 +196,7 @@
>  		vma = list_first_entry(&eviction_list,
>  				       struct i915_vma,
>  				       exec_list);
> -

Don't remove this line.

> -		obj =  vma->obj;
> +		obj = vma->obj;
>  		list_del_init(&vma->exec_list);
>  		if (ret == 0)
>  			ret = i915_vma_unbind(vma);
> diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
> index 8654a32..c10ce36 100644
> --- a/drivers/gpu/drm/i915/intel_overlay.c
> +++ b/drivers/gpu/drm/i915/intel_overlay.c
> @@ -1219,7 +1219,7 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,
>  out_unlock:
>  	mutex_unlock(&dev->struct_mutex);
>  	drm_modeset_unlock_all(dev);
> -	i915_gem_object_put(new_bo);
> +	i915_gem_object_put_unlocked(new_bo);

Otherwise,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index 81f7b43..6e09e11 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -196,8 +196,7 @@ 
 		vma = list_first_entry(&eviction_list,
 				       struct i915_vma,
 				       exec_list);
-
-		obj =  vma->obj;
+		obj = vma->obj;
 		list_del_init(&vma->exec_list);
 		if (ret == 0)
 			ret = i915_vma_unbind(vma);
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 8654a32..c10ce36 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -1219,7 +1219,7 @@  int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,
 out_unlock:
 	mutex_unlock(&dev->struct_mutex);
 	drm_modeset_unlock_all(dev);
-	i915_gem_object_put(new_bo);
+	i915_gem_object_put_unlocked(new_bo);
 out_free:
 	kfree(params);