Skip to content

Commit a9bf3ef

Browse files
author
Danilo Krummrich
committed
drm/nouveau: prime: fix refcount underflow
Calling nouveau_bo_ref() on a nouveau_bo without initializing it (and hence the backing ttm_bo) leads to a refcount underflow. Instead of calling nouveau_bo_ref() in the unwind path of drm_gem_object_init(), clean things up manually. Fixes: ab9ccb9 ("drm/nouveau: use prime helpers") Reviewed-by: Ben Skeggs <bskeggs@nvidia.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Danilo Krummrich <dakr@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20240718165959.3983-2-dakr@kernel.org (cherry picked from commit 1b93f3e) Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent 12c35c5 commit a9bf3ef

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/gpu/drm/nouveau/nouveau_prime.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev,
6464
* to the caller, instead of a normal nouveau_bo ttm reference. */
6565
ret = drm_gem_object_init(dev, &nvbo->bo.base, size);
6666
if (ret) {
67-
nouveau_bo_ref(NULL, &nvbo);
67+
drm_gem_object_release(&nvbo->bo.base);
68+
kfree(nvbo);
6869
obj = ERR_PTR(-ENOMEM);
6970
goto unlock;
7071
}

0 commit comments

Comments
 (0)