Re: [PATCH 1/2] drm/i915: Don't leak the DPT if drm_framebuffer_init() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 16, 2023 at 12:24:25AM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> 
> We are failing to free the already allocated DPT if the final
> drm_framebuffer_init() fails. That would require idr_alloc() to
> fail, so not very likely, but let's add the cleanup code anyway.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Reviewed-by: Matt Roper <matthew.d.roper@xxxxxxxxx>

> ---
>  drivers/gpu/drm/i915/display/intel_fb.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index 93d0e46e5481..1ba052a127b9 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -2017,11 +2017,14 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  	ret = drm_framebuffer_init(&dev_priv->drm, fb, &intel_fb_funcs);
>  	if (ret) {
>  		drm_err(&dev_priv->drm, "framebuffer init failed %d\n", ret);
> -		goto err;
> +		goto err_free_dpt;
>  	}
>  
>  	return 0;
>  
> +err_free_dpt:
> +	if (intel_fb_uses_dpt(fb))
> +		intel_dpt_destroy(intel_fb->dpt_vm);
>  err:
>  	intel_frontbuffer_put(intel_fb->frontbuffer);
>  	return ret;
> -- 
> 2.39.1
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux