Commit 32fda565 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/radeon: always set GEM function pointer

Make sure to always set the GEM function pointer even for in kernel
allocations. This fixes a NULL pointer deref caused by switching to GEM
references.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Fixes: fd69ef05 ("drm/radeon: use GEM references instead of TTMs")
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Tested-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 01b64bc063d014641631867a7e0edd8ac55282d4)
parent 79bc412e
...@@ -44,8 +44,6 @@ struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj); ...@@ -44,8 +44,6 @@ struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj);
int radeon_gem_prime_pin(struct drm_gem_object *obj); int radeon_gem_prime_pin(struct drm_gem_object *obj);
void radeon_gem_prime_unpin(struct drm_gem_object *obj); void radeon_gem_prime_unpin(struct drm_gem_object *obj);
const struct drm_gem_object_funcs radeon_gem_object_funcs;
static vm_fault_t radeon_gem_fault(struct vm_fault *vmf) static vm_fault_t radeon_gem_fault(struct vm_fault *vmf)
{ {
struct ttm_buffer_object *bo = vmf->vma->vm_private_data; struct ttm_buffer_object *bo = vmf->vma->vm_private_data;
...@@ -132,7 +130,6 @@ int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size, ...@@ -132,7 +130,6 @@ int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size,
return r; return r;
} }
*obj = &robj->tbo.base; *obj = &robj->tbo.base;
(*obj)->funcs = &radeon_gem_object_funcs;
robj->pid = task_pid_nr(current); robj->pid = task_pid_nr(current);
mutex_lock(&rdev->gem.mutex); mutex_lock(&rdev->gem.mutex);
......
...@@ -151,6 +151,7 @@ int radeon_bo_create(struct radeon_device *rdev, ...@@ -151,6 +151,7 @@ int radeon_bo_create(struct radeon_device *rdev,
if (bo == NULL) if (bo == NULL)
return -ENOMEM; return -ENOMEM;
drm_gem_private_object_init(rdev_to_drm(rdev), &bo->tbo.base, size); drm_gem_private_object_init(rdev_to_drm(rdev), &bo->tbo.base, size);
bo->tbo.base.funcs = &radeon_gem_object_funcs;
bo->rdev = rdev; bo->rdev = rdev;
bo->surface_reg = -1; bo->surface_reg = -1;
INIT_LIST_HEAD(&bo->list); INIT_LIST_HEAD(&bo->list);
......
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