Skip to contentSkip to conversation

drm/i915: check vma for error in ggtt_unpin_view

PATCH In review Matthew Auld 3 participants 3 messages Mar 23, 2016 – Mar 24, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: check vma for error in ggtt_unpin_view

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

Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +1 -1
index 8588c83..a8f3378 100644
@@ -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));
 
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915: check vma for error in ggtt_unpin_view

== Series Details ==

== Series Details ==

Series: drm/i915: check vma for error in ggtt_unpin_view
URL : https://patchwork.freedesktop.org/series/4812/
State : failure

== Summary ==

Series 4812v1 drm/i915: check vma for error in ggtt_unpin_view
http://patchwork.freedesktop.org/api/1.0/series/4812/revisions/1/mbox/

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-c:
                dmesg-warn -> PASS       (bsw-nuc-2)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                dmesg-warn -> PASS       (bsw-nuc-2)
        Subgroup basic-rte:
                dmesg-warn -> PASS       (byt-nuc) UNSTABLE
bdw-nuci7        total:192  pass:180  dwarn:0   dfail:0   fail:0   skip:12 
bdw-ultra        total:192  pass:171  dwarn:0   dfail:0   fail:0   skip:21 
bsw-nuc-2        total:192  pass:155  dwarn:0   dfail:0   fail:0   skip:37 
byt-nuc          total:192  pass:157  dwarn:0   dfail:0   fail:0   skip:35 
hsw-brixbox      total:192  pass:170  dwarn:0   dfail:0   fail:0   skip:22 
hsw-gt2          total:192  pass:175  dwarn:0   dfail:0   fail:0   skip:17 
ilk-hp8440p      total:192  pass:129  dwarn:0   dfail:0   fail:0   skip:63 
ivb-t430s        total:192  pass:167  dwarn:0   dfail:0   fail:0   skip:25 
skl-i7k-2        total:192  pass:169  dwarn:0   dfail:0   fail:0   skip:23 
skl-nuci5        total:192  pass:181  dwarn:0   dfail:0   fail:0   skip:11 
snb-x220t        total:192  pass:158  dwarn:0   dfail:0   fail:1   skip:33 

Results at /archive/results/CI_IGT_test/Patchwork_1694/

8f2e9bbc15607f56261aefd7a1f8caf6909c6b9d drm-intel-nightly: 2016y-03m-23d-17h-03m-10s UTC integration manifest 5b891b8bf0daf6f6655a7dc1c5a1e5275f7ab783 drm/i915: check vma for error in ggtt_unpin_view

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#2 lore raw
In reply to Matthew Auld
Quoted 17 lines · Matthew Auld

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

Cc Joonas Lahtinen <[email protected]>

---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 8588c83..a8f3378 100644
@@ -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);

drivers/gpu/drm/i915/i915_gem.c i915_gem_object_ggtt_unpin_view(struct drm_i915_gem_object *obj, · line 4322

Quoted 2 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
-	BUG_ON(!vma);
+	BUG_ON(IS_ERR_OR_NULL(vma));

Nicely spotted.

I discussed this with Tvrtko (CC'd him). I think we could change i915_gem_obj_to_ggtt_view to BUG_ON(!view) instead of adding the error handling in all places, as it is after all a programmer error to provide NULL view.

Regards, Joonas

Quoted 3 lines

  WARN_ON(vma->pin_count == 0); WARN_ON(!i915_gem_obj_ggtt_bound_view(obj, view));

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx