]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/gvt: fix double free bug in split_2MB_gtt_entry
authorZheng Wang <zyytlz.wz@163.com>
Thu, 29 Dec 2022 16:56:41 +0000 (00:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Feb 2023 10:53:26 +0000 (11:53 +0100)
commit3a97bd03fd7243a8ca979cf13c42e8c1f4fa5046
tree0ac67aab4bfba5e856cd57c391ba2c1e16e6d469
parent581d2e2e8bad61afca9ad2f15f048836a2b64bf4
drm/i915/gvt: fix double free bug in split_2MB_gtt_entry

commit 587ea5e52f0bdaf767e32acd16eebb6837bc84b0 upstream.

If intel_gvt_dma_map_guest_page failed, it will call
ppgtt_invalidate_spt, which will finally free the spt.
But the caller function ppgtt_populate_spt_by_guest_entry
does not notice that, it will free spt again in its error
path.

Fix this by canceling the mapping of DMA address and freeing sub_spt.
Besides, leave the handle of spt destroy to caller function instead
of callee function when error occurs.

Fixes: a97ac69b4b38 ("drm/i915/gvt: Add 2M huge gtt support")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20221229165641.1192455-1-zyytlz.wz@163.com
Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/i915/gvt/gtt.c