mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
drm/i915/gt: Fix a double free in gen8_preallocate_top_level_pdp
commitea995218ddupstream. 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:82adf90113("drm/i915/gt: Shrink i915_page_directory's slab bucket") Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Signed-off-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210426124340.4238-1-lyl2019@mail.ustc.edu.cn (cherry picked from commitac69496fe6) Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
20530f7fde
commit
17928443db
@@ -628,7 +628,6 @@ static int gen8_preallocate_top_level_pdp(struct i915_ppgtt *ppgtt)
|
||||
|
||||
err = pin_pt_dma(vm, pde->pt.base);
|
||||
if (err) {
|
||||
i915_gem_object_put(pde->pt.base);
|
||||
free_pd(vm, pde);
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user