Skip to content

Commit ea99521

Browse files
Yunlongsjnikula
authored andcommitted
drm/i915/gt: Fix a double free in gen8_preallocate_top_level_pdp
Our code analyzer reported a double free bug. In gen8_preallocate_top_level_pdp, pde and pde->pt.base are allocated via alloc_pd(vm) with one reference. If pin_pt_dma() failed, pde->pt.base is freed by i915_gem_object_put() with a reference dropped. Then free_pd calls free_px() defined in intel_ppgtt.c, which calls i915_gem_object_put() to put pde->pt.base again. As pde->pt.base is protected by refcount, so the second put will not free pde->pt.base actually. But, maybe it is better to remove the first put? Fixes: 82adf90 ("drm/i915/gt: Shrink i915_page_directory's slab bucket") Signed-off-by: Lv Yunlong <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Signed-off-by: Matthew Auld <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit ac69496) Signed-off-by: Jani Nikula <[email protected]>
1 parent 04d0199 commit ea99521

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/gpu/drm/i915/gt/gen8_ppgtt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,6 @@ static int gen8_preallocate_top_level_pdp(struct i915_ppgtt *ppgtt)
641641

642642
err = pin_pt_dma(vm, pde->pt.base);
643643
if (err) {
644-
i915_gem_object_put(pde->pt.base);
645644
free_pd(vm, pde);
646645
return err;
647646
}

0 commit comments

Comments
 (0)