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

drm/radeon: also init GEM funcs in radeon_gem_prime_import_sg_table

Otherwise we will run into a NULL ptr deref.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=212137Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0b4e9063
...@@ -567,6 +567,8 @@ struct radeon_gem { ...@@ -567,6 +567,8 @@ struct radeon_gem {
struct list_head objects; struct list_head objects;
}; };
extern const struct drm_gem_object_funcs radeon_gem_object_funcs;
int radeon_gem_init(struct radeon_device *rdev); int radeon_gem_init(struct radeon_device *rdev);
void radeon_gem_fini(struct radeon_device *rdev); void radeon_gem_fini(struct radeon_device *rdev);
int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size, int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size,
......
...@@ -42,7 +42,7 @@ struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj); ...@@ -42,7 +42,7 @@ 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);
static const struct drm_gem_object_funcs radeon_gem_object_funcs; const struct drm_gem_object_funcs radeon_gem_object_funcs;
static void radeon_gem_object_free(struct drm_gem_object *gobj) static void radeon_gem_object_free(struct drm_gem_object *gobj)
{ {
...@@ -226,7 +226,7 @@ static int radeon_gem_handle_lockup(struct radeon_device *rdev, int r) ...@@ -226,7 +226,7 @@ static int radeon_gem_handle_lockup(struct radeon_device *rdev, int r)
return r; return r;
} }
static const struct drm_gem_object_funcs radeon_gem_object_funcs = { const struct drm_gem_object_funcs radeon_gem_object_funcs = {
.free = radeon_gem_object_free, .free = radeon_gem_object_free,
.open = radeon_gem_object_open, .open = radeon_gem_object_open,
.close = radeon_gem_object_close, .close = radeon_gem_object_close,
......
...@@ -56,6 +56,8 @@ struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev, ...@@ -56,6 +56,8 @@ struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev,
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
bo->tbo.base.funcs = &radeon_gem_object_funcs;
mutex_lock(&rdev->gem.mutex); mutex_lock(&rdev->gem.mutex);
list_add_tail(&bo->list, &rdev->gem.objects); list_add_tail(&bo->list, &rdev->gem.objects);
mutex_unlock(&rdev->gem.mutex); mutex_unlock(&rdev->gem.mutex);
......
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