From: Christian König Date: Wed, 5 Sep 2018 15:04:44 +0000 (+0200) Subject: drm/amdgpu: set bulk_moveable to false when a per VM is released X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=fbbf794cbd4872cc4e894ab236d45c97b98008ea;p=openwrt%2Fstaging%2Fblogic.git drm/amdgpu: set bulk_moveable to false when a per VM is released Otherwise we might run into a use after free during bulk move. Signed-off-by: Christian König Reviewed-by: Huang Rui Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 9a5b1bbfb77c..f5a960079705 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2512,8 +2512,12 @@ void amdgpu_vm_bo_rmv(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va) { struct amdgpu_bo_va_mapping *mapping, *next; + struct amdgpu_bo *bo = bo_va->base.bo; struct amdgpu_vm *vm = bo_va->base.vm; + if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) + vm->bulk_moveable = false; + list_del(&bo_va->base.bo_list); spin_lock(&vm->invalidated_lock);