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 <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 1b93f3e) Signed-off-by: Danilo Krummrich <[email protected]>
1 parent 12c35c5 commit a9bf3ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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)