[PATCH] drivers/gpu/drm/i915/gvt/gtt.c: fix memory leak

Wang, Zhi A zhi.a.wang at intel.com
Tue Jul 4 04:27:21 UTC 2017


Also please re-send the email with Cc: Zhenyu Wang <zhenyuw at intel.com> as he gave you some comments before.

The prefix of the patch title should start with: drm/i915:

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

|< - Max 75 characters in one line ->|

One possible doc about submitting patches should be: Documentation/process/submitting-patches.rst

Thanks,
Zhi.

From: zhiyuan_zhu at htc.com [mailto:zhiyuan_zhu at htc.com]
Sent: Tuesday, July 4, 2017 6:13 AM
To: Wang, Zhi A <zhi.a.wang at intel.com>; zhenyuw at linux.intel.com; Zheng, Xiao <xiao.zheng at intel.com>; He, Min <min.he at intel.com>; Niu, Bing <bing.niu at intel.com>
Cc: intel-gvt-dev at lists.freedesktop.org; zijun_hu at htc.com
Subject: RE: [PATCH] drivers/gpu/drm/i915/gvt/gtt.c: fix memory leak

Hi Wang, Zhi A

Thanks for your kindly remind, modified in E-mail history,

---
Thanks,
Zhou, Wenjia
From: Wang, Zhi A [mailto:zhi.a.wang at intel.com]
Sent: Tuesday, July 04, 2017 11:08 AM
To: Zhiyuan Zhu(ÖìÖ¾ßh); zhenyuw at linux.intel.com<mailto:zhenyuw at linux.intel.com>; Zheng, Xiao; He, Min; Niu, Bing
Cc: intel-gvt-dev at lists.freedesktop.org<mailto:intel-gvt-dev at lists.freedesktop.org>; Zijun Hu(ºú×ÔÜŠ)
Subject: RE: [PATCH] drivers/gpu/drm/i915/gvt/gtt.c: fix memory leak

Hi Zhenjia:
Thanks for the contribution. You can change your name to ¡°Wenjia Zhou¡± or ¡°Zhou, Wenjia¡± in git username.

Thanks,
Zhi.

From: zhiyuan_zhu at htc.com<mailto:zhiyuan_zhu at htc.com> [mailto:zhiyuan_zhu at htc.com]
Sent: Tuesday, July 4, 2017 6:01 AM
To: Wang, Zhi A <zhi.a.wang at intel.com<mailto:zhi.a.wang at intel.com>>; zhenyuw at linux.intel.com<mailto:zhenyuw at linux.intel.com>; Zheng, Xiao <xiao.zheng at intel.com<mailto:xiao.zheng at intel.com>>; He, Min <min.he at intel.com<mailto:min.he at intel.com>>; Niu, Bing <bing.niu at intel.com<mailto:bing.niu at intel.com>>
Cc: intel-gvt-dev at lists.freedesktop.org<mailto:intel-gvt-dev at lists.freedesktop.org>; zijun_hu at htc.com<mailto:zijun_hu at htc.com>
Subject: [PATCH] drivers/gpu/drm/i915/gvt/gtt.c: fix memory leak

From: Zhou, Wenjia <zhiyuan_zhu at htc.com<mailto:zhiyuan_zhu at htc.com>>

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.

After STP oos initialize fail, unmap and free the page,
It will fix this issue.

Signed-off-by: Zhou, Wenjia <zhiyuan_zhu at htc.com<mailto:zhiyuan_zhu at htc.com>>
---
drivers/gpu/drm/i915/gvt/gtt.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
index c6f0077..f2b352b 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.c
+++ b/drivers/gpu/drm/i915/gvt/gtt.c
@@ -2254,6 +2254,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;
                }
        }
---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20170704/ade5c1e6/attachment-0001.html>


More information about the intel-gvt-dev mailing list