]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/nouveau/gem: fix "refcount_t: underflow; use-after-free"
authorKarol Herbst <kherbst@redhat.com>
Tue, 6 Oct 2020 22:08:09 +0000 (00:08 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 29 Oct 2020 23:34:12 +0000 (09:34 +1000)
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>
drivers/gpu/drm/nouveau/nouveau_gem.c

index 89adadf4706b456b5f1a0d8a85ae91273dc7e842..549bc67feabb4b645b6b1a9b2eecf46c2b435014 100644 (file)
@@ -190,7 +190,8 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain,
         * to the caller, instead of a normal nouveau_bo ttm reference. */
        ret = drm_gem_object_init(drm->dev, &nvbo->bo.base, size);
        if (ret) {
-               nouveau_bo_ref(NULL, &nvbo);
+               drm_gem_object_release(&nvbo->bo.base);
+               kfree(nvbo);
                return ret;
        }