[PATCH] drm/radeon: fix possible memory leak in radeon_bo_create
Christian König
ckoenig.leichtzumerken at gmail.com
Tue Nov 21 08:25:55 UTC 2017
Am 21.11.2017 um 05:36 schrieb Alex Deucher:
> if ttm_bo_init fails, don't leak the bo object.
NAK, see ttm_bo_init_reserved once more.
When the function fails it calls the destroy callback which releases the
memory.
Christian.
>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/radeon/radeon_object.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
> index 093594976126..53c5bb6c25e4 100644
> --- a/drivers/gpu/drm/radeon/radeon_object.c
> +++ b/drivers/gpu/drm/radeon/radeon_object.c
> @@ -262,6 +262,8 @@ int radeon_bo_create(struct radeon_device *rdev,
> acc_size, sg, resv, &radeon_ttm_bo_destroy);
> up_read(&rdev->pm.mclk_lock);
> if (unlikely(r != 0)) {
> + drm_gem_object_release(&bo->gem_base);
> + kfree(bo);
> return r;
> }
> *bo_ptr = bo;
More information about the amd-gfx
mailing list