All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/vmwgfx: fix ttm_base_object refcount leak in vmw_buffer_prime_to_surface_base()
@ 2026-06-08  3:27 Wentao Liang
  2026-06-08  3:37 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-06-08  3:27 UTC (permalink / raw)
  To: zack.rusin, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona
  Cc: bcm-kernel-feedback-list, dri-devel, linux-kernel, Wentao Liang,
	stable

vmw_lookup_user_surface_for_buffer() returns a pointer with a
temporary reference taken via kref_get_unless_zero(). The other
two callers (vmw_lookup_surface_for_buffer and
vmw_lookup_surface_handle_for_buffer) correctly release it with
ttm_base_object_unref(). vmw_buffer_prime_to_surface_base() does
not, leaking the reference on both the success and
ttm_ref_object_add() failure paths.

Add the missing ttm_base_object_unref() before vmw_user_bo_unref()
at the out label.

Cc: stable@vger.kernel.org
Fixes: d6667f0ddf46 ("drm/vmwgfx: Fix handling of dumb buffers")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index b2d3927b5567..9e63846fd663 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -972,6 +972,7 @@ static int vmw_buffer_prime_to_surface_base(struct vmw_private *dev_priv,
 
 	*base_p = base;
 out:
+	ttm_base_object_unref(&base);
 	vmw_user_bo_unref(&bo);
 
 	return ret;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-08  3:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08  3:27 [PATCH] drm/vmwgfx: fix ttm_base_object refcount leak in vmw_buffer_prime_to_surface_base() Wentao Liang
2026-06-08  3:37 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.