<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Yeah, we already documented the dma_fence_array() behavior on that function.<br>
<br>
But having another comment here would probably be a good idea.<br>
<br>
Christian.<br>
<br>
Am 23.09.19 um 14:35 schrieb Deucher, Alexander:<br>
</div>
<blockquote type="cite" cite="mid:BN6PR12MB1809C096DD42018B33EDFC4FF7850@BN6PR12MB1809.namprd12.prod.outlook.com">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);">
Maybe add a comment here in the code to avoid confusion in the future.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);">
Alex<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Koenig, Christian
<a class="moz-txt-link-rfc2396E" href="mailto:Christian.Koenig@amd.com"><Christian.Koenig@amd.com></a><br>
<b>Sent:</b> Saturday, September 21, 2019 7:32 AM<br>
<b>To:</b> Navid Emamdoost <a class="moz-txt-link-rfc2396E" href="mailto:navid.emamdoost@gmail.com">
<navid.emamdoost@gmail.com></a><br>
<b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:emamd001@umn.edu">emamd001@umn.edu</a>
<a class="moz-txt-link-rfc2396E" href="mailto:emamd001@umn.edu"><emamd001@umn.edu></a>;
<a class="moz-txt-link-abbreviated" href="mailto:smccaman@umn.edu">smccaman@umn.edu</a>
<a class="moz-txt-link-rfc2396E" href="mailto:smccaman@umn.edu"><smccaman@umn.edu></a>;
<a class="moz-txt-link-abbreviated" href="mailto:kjlu@umn.edu">kjlu@umn.edu</a> <a class="moz-txt-link-rfc2396E" href="mailto:kjlu@umn.edu">
<kjlu@umn.edu></a>; Deucher, Alexander <a class="moz-txt-link-rfc2396E" href="mailto:Alexander.Deucher@amd.com">
<Alexander.Deucher@amd.com></a>; Zhou, David(ChunMing) <a class="moz-txt-link-rfc2396E" href="mailto:David1.Zhou@amd.com">
<David1.Zhou@amd.com></a>; David Airlie <a class="moz-txt-link-rfc2396E" href="mailto:airlied@linux.ie">
<airlied@linux.ie></a>; Daniel Vetter <a class="moz-txt-link-rfc2396E" href="mailto:daniel@ffwll.ch">
<daniel@ffwll.ch></a>; Sam Ravnborg <a class="moz-txt-link-rfc2396E" href="mailto:sam@ravnborg.org">
<sam@ravnborg.org></a>; Rex Zhu <a class="moz-txt-link-rfc2396E" href="mailto:Rex.Zhu@amd.com">
<Rex.Zhu@amd.com></a>; <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">
amd-gfx@lists.freedesktop.org</a> <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx@lists.freedesktop.org">
<amd-gfx@lists.freedesktop.org></a>; <a class="moz-txt-link-abbreviated" href="mailto:dri-devel@lists.freedesktop.org">
dri-devel@lists.freedesktop.org</a> <a class="moz-txt-link-rfc2396E" href="mailto:dri-devel@lists.freedesktop.org">
<dri-devel@lists.freedesktop.org></a>; <a class="moz-txt-link-abbreviated" href="mailto:linux-kernel@vger.kernel.org">
linux-kernel@vger.kernel.org</a> <a class="moz-txt-link-rfc2396E" href="mailto:linux-kernel@vger.kernel.org">
<linux-kernel@vger.kernel.org></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: release allocated memory</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 21.09.19 um 00:49 schrieb Navid Emamdoost:<br>
> In amdgpu_vmid_grab_idle, fences is being leaked in one execution path.<br>
> The missing kfree was added.<br>
<br>
NAK, the array is freed by the dma_fence_array.  This is a double free.<br>
<br>
Regards,<br>
Christian.<br>
<br>
><br>
> Signed-off-by: Navid Emamdoost <a class="moz-txt-link-rfc2396E" href="mailto:navid.emamdoost@gmail.com">
<navid.emamdoost@gmail.com></a><br>
> ---<br>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 1 +<br>
>   1 file changed, 1 insertion(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c<br>
> index 57b3d8a9bef3..9063cd36fa94 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c<br>
> @@ -244,6 +244,7 @@ static int amdgpu_vmid_grab_idle(struct amdgpu_vm *vm,<br>
>                r = amdgpu_sync_fence(adev, sync, &array->base, false);<br>
>                dma_fence_put(ring->vmid_wait);<br>
>                ring->vmid_wait = &array->base;<br>
> +             kfree(fences);<br>
>                return r;<br>
>        }<br>
>        kfree(fences);<br>
<br>
</div>
</span></font></div>
</blockquote>
<br>
</body>
</html>