drm/nouveau: prime: fix refcount underflow
authorDanilo Krummrich <dakr@kernel.org>
Thu, 18 Jul 2024 16:58:46 +0000 (18:58 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Mon, 22 Jul 2024 20:53:38 +0000 (22:53 +0200)
commita9bf3efc33f1fbf88787a277f7349459283c9b95
tree8fa6c0f2802199196c90efa212a64d1dbec0297c
parent12c35c5582acb0fd8f7713ffa75f450766022ff1
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: ab9ccb96a6e6 ("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 1b93f3e89d03cfc576636e195466a0d728ad8de5)
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/gpu/drm/nouveau/nouveau_prime.c