[PATCH] drm/amdgpu: set metadata pointer to NULL after freeing.

Christian König deathsimple at vodafone.de
Tue May 3 07:06:12 UTC 2016


Am 03.05.2016 um 04:44 schrieb Dave Airlie:
> From: Dave Airlie <airlied at redhat.com>
>
> Without this there was a double free of the metadata,
> which ended up freeing the fd table for me here, and taking
> out the machine more often than not.
>
> I reproduced with X.org + modesetting DDX + latest llvm/mesa,
> also required using dri3.
>
> Cc: stable at vger.kernel.org
> Signed-off-by: Dave Airlie <airlied at redhat.com>

Nice catch, patch is Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index e557fc1..7ecea83 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -541,6 +541,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
>   	if (!metadata_size) {
>   		if (bo->metadata_size) {
>   			kfree(bo->metadata);
> +			bo->metadata = NULL;
>   			bo->metadata_size = 0;
>   		}
>   		return 0;



More information about the dri-devel mailing list