Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christian König and committed by
Alex Deucher
70eacc72 0994c09c

+3
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
··· 118 118 usermm = amdgpu_ttm_tt_get_usermm(entry->robj->tbo.ttm); 119 119 if (usermm) { 120 120 if (usermm != current->mm) { 121 + amdgpu_bo_unref(&entry->robj); 121 122 r = -EPERM; 122 123 goto error_free; 123 124 } ··· 152 151 return 0; 153 152 154 153 error_free: 154 + while (i--) 155 + amdgpu_bo_unref(&array[i].robj); 155 156 drm_free_large(array); 156 157 return r; 157 158 }