Message ID | 20250117191343.479610-1-ian.forbes@broadcom.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | drm/vmwgfx: Fix dumb buffer leak | expand |
On Fri, Jan 17, 2025 at 2:14 PM Ian Forbes <ian.forbes@broadcom.com> wrote: > > Fixes: d6667f0ddf46 ("drm/vmwgfx: Fix handling of dumb buffers") > Signed-off-by: Ian Forbes <ian.forbes@broadcom.com> > --- > drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 2 +- > drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 1 + > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c > index a0e433fbcba67..491062e1eb981 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c > @@ -73,7 +73,7 @@ static void vmw_bo_free(struct ttm_buffer_object *bo) > { > struct vmw_bo *vbo = to_vmw_bo(&bo->base); > > - WARN_ON(vbo->dirty); > + WARN_ON(vbo->dirty && !vbo->is_dumb); > WARN_ON(!RB_EMPTY_ROOT(&vbo->res_tree)); > vmw_bo_release(vbo); > kfree(vbo); > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c > index 5721c74da3e0b..3210941cca302 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c > @@ -2358,6 +2358,7 @@ int vmw_dumb_create(struct drm_file *file_priv, > vbo = res->guest_memory_bo; > vbo->is_dumb = true; > vbo->dumb_surface = vmw_res_to_srf(res); > + drm_gem_object_put(&vbo->tbo.base); > > err: > if (res) > -- > 2.34.1 > You're going to have to explain that one in the commit message a lot better because as is it doesn't make sense to me. Especially the !vbo->is_dumb in vmw_bo_free. z
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c index a0e433fbcba67..491062e1eb981 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c @@ -73,7 +73,7 @@ static void vmw_bo_free(struct ttm_buffer_object *bo) { struct vmw_bo *vbo = to_vmw_bo(&bo->base); - WARN_ON(vbo->dirty); + WARN_ON(vbo->dirty && !vbo->is_dumb); WARN_ON(!RB_EMPTY_ROOT(&vbo->res_tree)); vmw_bo_release(vbo); kfree(vbo); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 5721c74da3e0b..3210941cca302 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -2358,6 +2358,7 @@ int vmw_dumb_create(struct drm_file *file_priv, vbo = res->guest_memory_bo; vbo->is_dumb = true; vbo->dumb_surface = vmw_res_to_srf(res); + drm_gem_object_put(&vbo->tbo.base); err: if (res)
Fixes: d6667f0ddf46 ("drm/vmwgfx: Fix handling of dumb buffers") Signed-off-by: Ian Forbes <ian.forbes@broadcom.com> --- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)