[Intel-gfx] [PATCH] drm/i915: check vma for error in ggtt_unpin_view

Matthew Auld matthew.auld at intel.com
Wed Mar 23 15:39:44 UTC 2016


When unpinning a ggtt_view check vma for error, otherwise we may end up
accessing an invalid pointer.

Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Signed-off-by: Matthew Auld <matthew.auld at intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8588c83..a8f3378 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4319,7 +4319,7 @@ i915_gem_object_ggtt_unpin_view(struct drm_i915_gem_object *obj,
 {
 	struct i915_vma *vma = i915_gem_obj_to_ggtt_view(obj, view);
 
-	BUG_ON(!vma);
+	BUG_ON(IS_ERR_OR_NULL(vma));
 	WARN_ON(vma->pin_count == 0);
 	WARN_ON(!i915_gem_obj_ggtt_bound_view(obj, view));
 
-- 
2.4.3



More information about the Intel-gfx mailing list