mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
drm/amdgpu: fix error handling in amdgpu_bo_list_set
Don't leak BOs in case of some error. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
0994c09c04
commit
70eacc72db
|
|
@ -118,6 +118,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
|
|||
usermm = amdgpu_ttm_tt_get_usermm(entry->robj->tbo.ttm);
|
||||
if (usermm) {
|
||||
if (usermm != current->mm) {
|
||||
amdgpu_bo_unref(&entry->robj);
|
||||
r = -EPERM;
|
||||
goto error_free;
|
||||
}
|
||||
|
|
@ -151,6 +152,8 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
|
|||
return 0;
|
||||
|
||||
error_free:
|
||||
while (i--)
|
||||
amdgpu_bo_unref(&array[i].robj);
|
||||
drm_free_large(array);
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user