We were overwriting the surface's dirty tracker here causing a memory leak.

Reported-by: Mika Penttilä <[email protected]>
Closes: 
https://lore.kernel.org/dri-devel/[email protected]/
Fixes: 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
Signed-off-by: Ian Forbes <[email protected]>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 55730e29d3ae..e7bddf840a79 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -771,7 +771,8 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct 
drm_device *dev,
                ret = vmw_bo_dirty_add(bo);
                if (!ret && surface && surface->res.func->dirty_alloc) {
                        surface->res.coherent = true;
-                       ret = surface->res.func->dirty_alloc(&surface->res);
+                       if (surface->res.dirty == NULL)
+                               ret = 
surface->res.func->dirty_alloc(&surface->res);
                }
                ttm_bo_unreserve(&bo->tbo);
        }
-- 
2.53.0

Reply via email to