[PATCH] drm/amdgpu: release allocated memory

Koenig, Christian Christian.Koenig at amd.com
Mon Sep 23 12:58:35 UTC 2019


Yeah, we already documented the dma_fence_array() behavior on that function.

But having another comment here would probably be a good idea.

Christian.

Am 23.09.19 um 14:35 schrieb Deucher, Alexander:
Maybe add a comment here in the code to avoid confusion in the future.

Alex
________________________________
From: Koenig, Christian <Christian.Koenig at amd.com><mailto:Christian.Koenig at amd.com>
Sent: Saturday, September 21, 2019 7:32 AM
To: Navid Emamdoost <navid.emamdoost at gmail.com><mailto:navid.emamdoost at gmail.com>
Cc: emamd001 at umn.edu<mailto:emamd001 at umn.edu> <emamd001 at umn.edu><mailto:emamd001 at umn.edu>; smccaman at umn.edu<mailto:smccaman at umn.edu> <smccaman at umn.edu><mailto:smccaman at umn.edu>; kjlu at umn.edu<mailto:kjlu at umn.edu> <kjlu at umn.edu><mailto:kjlu at umn.edu>; Deucher, Alexander <Alexander.Deucher at amd.com><mailto:Alexander.Deucher at amd.com>; Zhou, David(ChunMing) <David1.Zhou at amd.com><mailto:David1.Zhou at amd.com>; David Airlie <airlied at linux.ie><mailto:airlied at linux.ie>; Daniel Vetter <daniel at ffwll.ch><mailto:daniel at ffwll.ch>; Sam Ravnborg <sam at ravnborg.org><mailto:sam at ravnborg.org>; Rex Zhu <Rex.Zhu at amd.com><mailto:Rex.Zhu at amd.com>; amd-gfx at lists.freedesktop.org<mailto:amd-gfx at lists.freedesktop.org> <amd-gfx at lists.freedesktop.org><mailto:amd-gfx at lists.freedesktop.org>; dri-devel at lists.freedesktop.org<mailto:dri-devel at lists.freedesktop.org> <dri-devel at lists.freedesktop.org><mailto:dri-devel at lists.freedesktop.org>; linux-kernel at vger.kernel.org<mailto:linux-kernel at vger.kernel.org> <linux-kernel at vger.kernel.org><mailto:linux-kernel at vger.kernel.org>
Subject: Re: [PATCH] drm/amdgpu: release allocated memory

Am 21.09.19 um 00:49 schrieb Navid Emamdoost:
> In amdgpu_vmid_grab_idle, fences is being leaked in one execution path.
> The missing kfree was added.

NAK, the array is freed by the dma_fence_array.  This is a double free.

Regards,
Christian.

>
> Signed-off-by: Navid Emamdoost <navid.emamdoost at gmail.com><mailto:navid.emamdoost at gmail.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> index 57b3d8a9bef3..9063cd36fa94 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> @@ -244,6 +244,7 @@ static int amdgpu_vmid_grab_idle(struct amdgpu_vm *vm,
>                r = amdgpu_sync_fence(adev, sync, &array->base, false);
>                dma_fence_put(ring->vmid_wait);
>                ring->vmid_wait = &array->base;
> +             kfree(fences);
>                return r;
>        }
>        kfree(fences);


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190923/0ef70802/attachment-0001.html>


More information about the dri-devel mailing list