[PATCH] drm/radeon: memory leak on bo reservation failure. v2

Alex Deucher alexdeucher at gmail.com
Tue Apr 15 06:12:38 PDT 2014


On Tue, Apr 15, 2014 at 5:28 AM, Christian König
<deathsimple at vodafone.de> wrote:
> From: Quentin Casasnovas <quentin.casasnovas at oracle.com>
>
> On bo reservation failure, we end up leaking fpriv.
>
> v2 (chk): rebased and added missing free on vm failure as well
>
> Fixes: 5e386b574cf7e1 ("drm/radeon: fix missing bo reservation")
> Cc: stable at vger.kernel.org
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Quentin Casasnovas <quentin.casasnovas at oracle.com>
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/radeon/radeon_kms.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index 9337820..fb3d13f 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -574,12 +574,17 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
>                 }
>
>                 r = radeon_vm_init(rdev, &fpriv->vm);
> -               if (r)
> +               if (r) {
> +                       kfree(fpriv);
>                         return r;
> +               }
>
>                 r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
> -               if (r)
> +               if (r) {
> +                       radeon_vm_fini(rdev, &fpriv->vm);
> +                       kfree(fpriv);
>                         return r;
> +               }
>
>                 /* map the ib pool buffer read only into
>                  * virtual address space */
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list