Commit 70eacc72 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: fix error handling in amdgpu_bo_list_set

Don't leak BOs in case of some error.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0994c09c
...@@ -118,6 +118,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev, ...@@ -118,6 +118,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
usermm = amdgpu_ttm_tt_get_usermm(entry->robj->tbo.ttm); usermm = amdgpu_ttm_tt_get_usermm(entry->robj->tbo.ttm);
if (usermm) { if (usermm) {
if (usermm != current->mm) { if (usermm != current->mm) {
amdgpu_bo_unref(&entry->robj);
r = -EPERM; r = -EPERM;
goto error_free; goto error_free;
} }
...@@ -151,6 +152,8 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev, ...@@ -151,6 +152,8 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
return 0; return 0;
error_free: error_free:
while (i--)
amdgpu_bo_unref(&array[i].robj);
drm_free_large(array); drm_free_large(array);
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment