diff mbox

[2/2] drm/i915: use after free on error path

Message ID 20130719054627.GA9729@elgon.mountain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter July 19, 2013, 5:46 a.m. UTC
i915_gem_vma_destroy() frees its argument so we have to move the
drm_mm_remove_node() call up a few lines.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Daniel Vetter July 19, 2013, 7:01 a.m. UTC | #1
On Fri, Jul 19, 2013 at 08:46:27AM +0300, Dan Carpenter wrote:
> i915_gem_vma_destroy() frees its argument so we have to move the
> drm_mm_remove_node() call up a few lines.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Both applied, thanks for the patches.
-Daniel

> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 9a9a77a..f347ad5 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3161,9 +3161,9 @@ search_free:
>  	return 0;
>  
>  err_out:
> +	drm_mm_remove_node(&vma->node);
>  	i915_gem_vma_destroy(vma);
>  	i915_gem_object_unpin_pages(obj);
> -	drm_mm_remove_node(&vma->node);
>  	return ret;
>  }
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9a9a77a..f347ad5 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3161,9 +3161,9 @@  search_free:
 	return 0;
 
 err_out:
+	drm_mm_remove_node(&vma->node);
 	i915_gem_vma_destroy(vma);
 	i915_gem_object_unpin_pages(obj);
-	drm_mm_remove_node(&vma->node);
 	return ret;
 }