* [PATCH] drm/i915/gvt: fix refcount leak in intel_vgpu_shadow_mm_pin()
@ 2026-06-06 10:35 Wentao Liang
0 siblings, 0 replies; only message in thread
From: Wentao Liang @ 2026-06-06 10:35 UTC (permalink / raw)
To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin, airlied, simona
Cc: zhenyuw.linux, zhi.wang.linux, intel-gfx, dri-devel,
linux-kernel, Wentao Liang, stable
intel_vgpu_pin_mm() unconditionally increments the mm's pincount at
the start. If the subsequent shadow ppgtt creation fails, the
function returns an error but leaves the pincount incremented.
Callers must therefore always call intel_vgpu_unpin_mm() after
intel_vgpu_pin_mm() returns, regardless of success or failure, to
balance the reference.
In intel_vgpu_shadow_mm_pin(), when the pinning of the shadow mm
fails, the error path returns immediately without unpinning. This
leaks the pincount reference that was already taken. All other error
paths in the same function correctly unpin on failure, making this an
obvious omission.
Add the missing intel_vgpu_unpin_mm() call before returning the error.
Cc: stable@vger.kernel.org
Fixes: d8235b5e5584 ("drm/i915/gvt: Move common workload preparation into prepare_workload()")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/gpu/drm/i915/gvt/scheduler.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c
index 15fdd514ca83..30d879b37c84 100644
--- a/drivers/gpu/drm/i915/gvt/scheduler.c
+++ b/drivers/gpu/drm/i915/gvt/scheduler.c
@@ -698,6 +698,7 @@ intel_vgpu_shadow_mm_pin(struct intel_vgpu_workload *workload)
ret = intel_vgpu_pin_mm(workload->shadow_mm);
if (ret) {
+ intel_vgpu_unpin_mm(workload->shadow_mm);
gvt_vgpu_err("fail to vgpu pin mm\n");
return ret;
}
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-06 10:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-06 10:35 [PATCH] drm/i915/gvt: fix refcount leak in intel_vgpu_shadow_mm_pin() Wentao Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®