[PATCH] drm/vmwgfx: Fix potential memory leak in vmw_fifo_create()

From: Abdun Nihaal
Date: Mon Nov 10 2025 - 10:49:34 EST


The memory allocated for fifo and fifo->static_buffer is not freed on
one of the error paths. Fix that by freeing them.

Fixes: c451af78f301 ("drm/vmwgfx: Fail to initialize on broken configs")
Signed-off-by: Abdun Nihaal <nihaal@xxxxxxxxxxxxxx>
---
Compile tested only. Found using static analysis.

drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
index 8fe02131a6c4..a9fbdfd3a718 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
@@ -150,6 +150,8 @@ struct vmw_fifo_state *vmw_fifo_create(struct vmw_private *dev_priv)
if (unlikely(min >= max)) {
drm_warn(&dev_priv->drm,
"FIFO memory is not usable. Driver failed to initialize.");
+ vfree(fifo->static_buffer);
+ kfree(fifo);
return ERR_PTR(-ENXIO);
}

--
2.43.0