drm/nouveau: unpin pushbuffer bo before destroying it
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Sun, 25 Nov 2012 22:02:28 +0000 (23:02 +0100)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 28 Nov 2012 23:58:11 +0000 (09:58 +1000)
Fixes GART leak (as accounted by nouveau_drm.gem.gart_available).

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_chan.c

index 1363578bf94570f6f46226c456d8ed6e20138677..174300b6a02e0d0654d825b69b2c7194c6ffec3a 100644 (file)
@@ -76,6 +76,8 @@ nouveau_channel_del(struct nouveau_channel **pchan)
                nouveau_object_del(client, NVDRM_DEVICE, chan->push.handle);
                nouveau_bo_vma_del(chan->push.buffer, &chan->push.vma);
                nouveau_bo_unmap(chan->push.buffer);
+               if (chan->push.buffer && chan->push.buffer->pin_refcnt)
+                       nouveau_bo_unpin(chan->push.buffer);
                nouveau_bo_ref(NULL, &chan->push.buffer);
                kfree(chan);
        }