]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Gracefully handle obj not bound to GGTT in is_pin_display
authorOscar Mateo <oscar.mateo@intel.com>
Fri, 16 May 2014 13:20:43 +0000 (14:20 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 16 May 2014 14:24:39 +0000 (16:24 +0200)
commit0be40b332fcdd76c9cb0ac76f9f5b118fa2112aa
tree30f04ee74dedb780372e4e77a885903ab1c0ccef
parent309324fa981b08bf1d2947dc874da08d6edec0a4
drm/i915: Gracefully handle obj not bound to GGTT in is_pin_display

Otherwise, we do a NULL pointer dereference.

I've seen this happen while handling an error in
i915_gem_object_pin_to_display_plane():

If i915_gem_object_set_cache_level() fails, we call is_pin_display()
to handle the error. At this point, the object is still not pinned
to GGTT and maybe not even bound, so we have to check before we
dereference its GGTT vma.

The IGT kms_flip/bo-too-big tests for this bug.

v2: Chris Wilson says restoring the old value is easier, but that
is_pin_display is useful as a theory of operation. Take the solomonic
decision: at least this way is_pin_display is a little more robust
(until Chris can kill it off).

v3: Chris suggests the WARN in i915_gem_obj_to_ggtt has outlived its
usefulness: add a reminder to remove it.

Issue: VIZ-3772
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
Testcase: igt/kms_flip/bo-too-big
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem.c