The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] fix: drm/vmwgfx: vmw_user_shader_alloc: fix base object refcount leak on   ttm_base_object_init failure
@ 2026-06-26 15:01 WenTao Liang
  2026-06-28  4:03 ` WenTao Liang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: WenTao Liang @ 2026-06-26 15:01 UTC (permalink / raw)
  To: Zack Rusin, dri-devel
  Cc: bcm-kernel-feedback-list, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Thomas Hellstrom,
	stable, linux-kernel, WenTao Liang

ttm_base_object_init unconditionally acquires a base object reference via
  kref_init. When it fails, the error path in vmw_user_shader_alloc only
  calls vmw_resource_unreference but never calls ttm_base_object_unref to
  release the base object reference, causing a refcount leak.

Add ttm_base_object_unref in the error path to properly release the base
  object reference when ttm_base_object_init fails.

Cc: stable@vger.kernel.org
Fixes: 0b8762e997df ("drm/ttm, drm/vmwgfx: Move the lock- and object functionality to the vmwgfx driver")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index eca4e3e97eb4..d82ec43c8901 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -724,6 +724,7 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
 
 	if (unlikely(ret != 0)) {
 		vmw_resource_unreference(&tmp);
+		ttm_base_object_unref(&ushader->base);
 		goto out_err;
 	}
 
-- 
2.39.5 (Apple Git-154)


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

end of thread, other threads:[~2026-08-08  0:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 15:01 [PATCH] fix: drm/vmwgfx: vmw_user_shader_alloc: fix base object refcount leak on ttm_base_object_init failure WenTao Liang
2026-06-28  4:03 ` WenTao Liang
2026-08-07 20:24 ` kernel test robot
2026-08-08  0:58 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox