aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers
diff options
context:
space:
mode:
authorKarol Herbst <kherbst@redhat.com>2020-10-07 00:08:09 +0200
committerBen Skeggs <bskeggs@redhat.com>2020-10-30 09:34:12 +1000
commit925681454d7b557d404b5d28ef4469fac1b2e105 (patch)
tree38ba3c4f2cd8b9a750481a943cb2ec56cd519be0 /drivers
parentdrm/nouveau/kms/nv50-: Program notifier offset before requesting disp caps (diff)
downloadwireguard-linux-925681454d7b557d404b5d28ef4469fac1b2e105.tar.xz
wireguard-linux-925681454d7b557d404b5d28ef4469fac1b2e105.zip
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 89adadf4706b..549bc67feabb 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -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;
}