Commit 0de98709 authored by Zhou, Wenjia's avatar Zhou, Wenjia Committed by Zhenyu Wang

drm/i915/gvt: Fix a memory leak in intel_gvt_init_gtt()

It will causes memory leak, if the function setup_spt_oos() fail,
in the function intel_gvt_init_gtt(),
which allocated by get_zeroed_page() and mapped by dma_map_page().

Unmap and free the page,  after STP oos initialize fail,
it will fix this issue.
Signed-off-by: default avatarZhou, Wenjia <zhiyuan_zhu@htc.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent 7581d5ca
......@@ -2259,6 +2259,8 @@ int intel_gvt_init_gtt(struct intel_gvt *gvt)
ret = setup_spt_oos(gvt);
if (ret) {
gvt_err("fail to initialize SPT oos\n");
dma_unmap_page(dev, daddr, 4096, PCI_DMA_BIDIRECTIONAL);
__free_page(gvt->gtt.scratch_ggtt_page);
return ret;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment