Skip to content

Commit 9256814

Browse files
karolherbstBen Skeggs
authored andcommitted
drm/nouveau/gem: fix "refcount_t: underflow; use-after-free"
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>
1 parent 24d9422 commit 9256814

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
@@ -190,7 +190,8 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain,
190190
* to the caller, instead of a normal nouveau_bo ttm reference. */
191191
ret = drm_gem_object_init(drm->dev, &nvbo->bo.base, size);
192192
if (ret) {
193-
nouveau_bo_ref(NULL, &nvbo);
193+
drm_gem_object_release(&nvbo->bo.base);
194+
kfree(nvbo);
194195
return ret;
195196
}
196197

0 commit comments

Comments
 (0)