Skip to content

Commit b74c934

Browse files
karolherbstgregkh
authored andcommitted
drm/nouveau/gem: fix "refcount_t: underflow; use-after-free"
[ Upstream commit 9256814 ] we can't use nouveau_bo_ref here as no ttm object was allocated and nouveau_bo_ref mainly deals with that. Simply deallocate the object. Signed-off-by: Karol Herbst <kherbst@redhat.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0092965 commit b74c934

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/gpu/drm/nouveau/nouveau_gem.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain,
198198
* to the caller, instead of a normal nouveau_bo ttm reference. */
199199
ret = drm_gem_object_init(drm->dev, &nvbo->bo.base, size);
200200
if (ret) {
201-
nouveau_bo_ref(NULL, &nvbo);
201+
drm_gem_object_release(&nvbo->bo.base);
202+
kfree(nvbo);
202203
return ret;
203204
}
204205

0 commit comments

Comments
 (0)