mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-03 19:24:02 +08:00
drm/radeon: avoid segfault on device open when accel is not working.
When accel is not working on device with virtual address space radeon segfault because the ib buffer is NULL and trying to map it inside the virtual address space trigger segfault. This patch only map the ib buffer if accel is working. Cc: <stable@vger.kernel.org> Signed-off-by: Jérôme Glisse <jglisse@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
74ad54f249
commit
24f47acc78
@ -577,6 +577,7 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rdev->accel_working) {
|
||||||
r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
|
r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
|
||||||
if (r) {
|
if (r) {
|
||||||
radeon_vm_fini(rdev, &fpriv->vm);
|
radeon_vm_fini(rdev, &fpriv->vm);
|
||||||
@ -598,7 +599,7 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
|
|||||||
kfree(fpriv);
|
kfree(fpriv);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
file_priv->driver_priv = fpriv;
|
file_priv->driver_priv = fpriv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,6 +627,7 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
|
|||||||
struct radeon_bo_va *bo_va;
|
struct radeon_bo_va *bo_va;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
if (rdev->accel_working) {
|
||||||
r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
|
r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
bo_va = radeon_vm_bo_find(&fpriv->vm,
|
bo_va = radeon_vm_bo_find(&fpriv->vm,
|
||||||
@ -634,6 +636,7 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
|
|||||||
radeon_vm_bo_rmv(rdev, bo_va);
|
radeon_vm_bo_rmv(rdev, bo_va);
|
||||||
radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
|
radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
radeon_vm_fini(rdev, &fpriv->vm);
|
radeon_vm_fini(rdev, &fpriv->vm);
|
||||||
kfree(fpriv);
|
kfree(fpriv);
|
||||||
|
Loading…
Reference in New Issue
Block a user