[PATCH] drm/amdgpu/vcn: Fix double-free of vcn dump buffer

Sundararaju, Sathishkumar sathishkumar.sundararaju at amd.com
Tue Aug 5 13:14:54 UTC 2025


This patch is:
Reviewed-by: Sathishkumar S <sathishkumar.sundararaju at amd.com>


On 8/5/2025 5:55 PM, Lijo Lazar wrote:
> The buffer is already freed as part of amdgpu_vcn_reg_dump_fini(). The
> issue is introduced by below patch series.
>
> Fixes: 699853ae00ca ("drm/amdgpu/vcn: Add regdump helper functions")
>
> Signed-off-by: Lijo Lazar <lijo.lazar at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 1 +
>   drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c   | 1 -
>   drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 2 --
>   drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 2 --
>   4 files changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> index b497a6714138..050a5411aae5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> @@ -1549,6 +1549,7 @@ int amdgpu_vcn_reg_dump_init(struct amdgpu_device *adev,
>   static void amdgpu_vcn_reg_dump_fini(struct amdgpu_device *adev)
>   {
>   	kfree(adev->vcn.ip_dump);
> +	adev->vcn.ip_dump = NULL;
>   	adev->vcn.reg_list = NULL;
>   	adev->vcn.reg_count = 0;
>   }
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> index ff2a85619f23..95173156f956 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> @@ -354,7 +354,6 @@ static int vcn_v3_0_sw_fini(struct amdgpu_ip_block *ip_block)
>   			return r;
>   	}
>   
> -	kfree(adev->vcn.ip_dump);
>   	return 0;
>   }
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
> index c6450ed65c12..019bd362edb2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
> @@ -280,8 +280,6 @@ static int vcn_v4_0_3_sw_fini(struct amdgpu_ip_block *ip_block)
>   			return r;
>   	}
>   
> -	kfree(adev->vcn.ip_dump);
> -
>   	return 0;
>   }
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
> index f785467370d9..75c884a8f556 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
> @@ -275,8 +275,6 @@ static int vcn_v4_0_5_sw_fini(struct amdgpu_ip_block *ip_block)
>   			return r;
>   	}
>   
> -	kfree(adev->vcn.ip_dump);
> -
>   	return 0;
>   }
>   


More information about the amd-gfx mailing list