Maybe add a comment here in the code to avoid confusion in the future.
Alex
From: Koenig, Christian <Christian.Koenig@xxxxxxx>
Sent: Saturday, September 21, 2019 7:32 AM To: Navid Emamdoost <navid.emamdoost@xxxxxxxxx> Cc: emamd001@xxxxxxx <emamd001@xxxxxxx>; smccaman@xxxxxxx <smccaman@xxxxxxx>; kjlu@xxxxxxx <kjlu@xxxxxxx>; Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Zhou, David(ChunMing) <David1.Zhou@xxxxxxx>; David Airlie <airlied@xxxxxxxx>; Daniel Vetter <daniel@xxxxxxxx>; Sam Ravnborg <sam@xxxxxxxxxxxx>; Rex Zhu <Rex.Zhu@xxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>; dri-devel@xxxxxxxxxxxxxxxxxxxxx <dri-devel@xxxxxxxxxxxxxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx <linux-kernel@xxxxxxxxxxxxxxx> 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@xxxxxxxxx> > --- > 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); |
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel