From: Zhou, Wenjia Date: Tue, 4 Jul 2017 07:47:00 +0000 (+0800) Subject: drm/i915/gvt: Fix a memory leak in intel_gvt_init_gtt() X-Git-Tag: v4.14-rc1~241^2~1^2^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0de98709896d9c02ce3121ec3afb524253a5853f;p=platform%2Fkernel%2Flinux-rpi.git 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: Zhou, Wenjia Signed-off-by: Zhenyu Wang --- diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c index 66374db..6166e34 100644 --- a/drivers/gpu/drm/i915/gvt/gtt.c +++ b/drivers/gpu/drm/i915/gvt/gtt.c @@ -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; } }