[Intel-gfx] [PATCH] drm/i915/gvt: Use after free in intel_vgpu_destroy_ggtt_mm()

Dan Carpenter dan.carpenter at oracle.com
Fri Nov 23 07:22:19 UTC 2018


We need to use the _safe() version of this macro so that we don't
dereference "pos" when it is freed.

Fixes: bc0686ff5fad ("drm/i915/gvt: support inconsecutive partial gtt entry write")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
 drivers/gpu/drm/i915/gvt/gtt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
index 58e166effa45..3f416341ae5f 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.c
+++ b/drivers/gpu/drm/i915/gvt/gtt.c
@@ -2447,9 +2447,9 @@ static void intel_vgpu_destroy_all_ppgtt_mm(struct intel_vgpu *vgpu)
 
 static void intel_vgpu_destroy_ggtt_mm(struct intel_vgpu *vgpu)
 {
-	struct intel_gvt_partial_pte *pos;
+	struct intel_gvt_partial_pte *pos, *n;
 
-	list_for_each_entry(pos,
+	list_for_each_entry_safe(pos, n,
 			&vgpu->gtt.ggtt_mm->ggtt_mm.partial_pte_list, list) {
 		gvt_dbg_mm("partial PTE update on hold 0x%lx : 0x%llx\n",
 			pos->offset, pos->data);
-- 
2.11.0



More information about the Intel-gfx mailing list