* [PATCH 0/2] drm-i915: Fix resource lifetime and error-unwind issues
@ 2026-12-04 13:31 Tian Xuechen
2026-12-04 13:31 ` [PATCH 1/2] drm/i915/gvt: Fix potential GGTT leak on scratch tree failure Tian Xuechen
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Tian Xuechen @ 2026-12-04 13:31 UTC (permalink / raw)
To: zhenyuw.linux
Cc: zhi.wang.linux, jani.nikula, joonas.lahtinen, rodrigo.vivi,
tursulin, airlied, simona, ping.a.gao, intel-gfx, dri-devel,
linux-kernel, matthew.auld, thomas.hellstrom
Fix the resource lifetime and error-unwind issues described in the
individual patches.
The changes were statically audited against Linux 7.3-rc7 (24a19b953e2a).
Target object build results and limitations are recorded in the accompanying
review manifest; no runtime or hardware test is claimed.
Tian Xuechen (2):
drm/i915/gvt: Fix potential GGTT leak on scratch tree failure
drm/i915/selftests: Fix potential instance ID leak
drivers/gpu/drm/i915/gvt/gtt.c | 9 +++++++-
drivers/gpu/drm/i915/selftests/mock_region.c | 22 ++++++++++++++++----
2 files changed, 26 insertions(+), 5 deletions(-)
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] drm/i915/gvt: Fix potential GGTT leak on scratch tree failure
2026-12-04 13:31 [PATCH 0/2] drm-i915: Fix resource lifetime and error-unwind issues Tian Xuechen
@ 2026-12-04 13:31 ` Tian Xuechen
2026-12-04 13:49 ` sashiko-bot
2026-12-04 13:31 ` [PATCH 2/2] drm/i915/selftests: Fix potential instance ID leak Tian Xuechen
2026-12-05 0:06 ` ✗ LGCI.VerificationFailed: failure for drm-i915: Fix resource lifetime and error-unwind issues Patchwork
2 siblings, 1 reply; 5+ messages in thread
From: Tian Xuechen @ 2026-12-04 13:31 UTC (permalink / raw)
To: zhenyuw.linux
Cc: zhi.wang.linux, jani.nikula, joonas.lahtinen, rodrigo.vivi,
tursulin, airlied, simona, ping.a.gao, intel-gfx, dri-devel,
linux-kernel, matthew.auld, thomas.hellstrom
GGTT allocation precedes scratch page-tree creation. If the latter fails,
its local unwind releases only scratch pages, and the outer vGPU unwind
skips GTT cleanup because initialization did not succeed.
Drop the newly created GGTT and clear its pointer on this failure.
This issue was found by our static analysis tool under development.
Fixes: 3b6411c2c205 ("drm/i915/gvt: implement scratch page table tree for shadow PPGTT")
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/gpu/drm/i915/gvt/gtt.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
index 5056a5887b31..17d61548ec05 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.c
+++ b/drivers/gpu/drm/i915/gvt/gtt.c
@@ -2403,6 +2403,7 @@ static int create_scratch_page_tree(struct intel_vgpu *vgpu)
int intel_vgpu_init_gtt(struct intel_vgpu *vgpu)
{
struct intel_vgpu_gtt *gtt = &vgpu->gtt;
+ int ret;
INIT_RADIX_TREE(>t->spt_tree, GFP_KERNEL);
@@ -2420,7 +2421,13 @@ int intel_vgpu_init_gtt(struct intel_vgpu *vgpu)
INIT_LIST_HEAD(>t->ggtt_mm->ggtt_mm.partial_pte_list);
- return create_scratch_page_tree(vgpu);
+ ret = create_scratch_page_tree(vgpu);
+ if (ret) {
+ intel_vgpu_destroy_mm(gtt->ggtt_mm);
+ gtt->ggtt_mm = NULL;
+ }
+
+ return ret;
}
void intel_vgpu_destroy_all_ppgtt_mm(struct intel_vgpu *vgpu)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/i915/selftests: Fix potential instance ID leak
2026-12-04 13:31 [PATCH 0/2] drm-i915: Fix resource lifetime and error-unwind issues Tian Xuechen
2026-12-04 13:31 ` [PATCH 1/2] drm/i915/gvt: Fix potential GGTT leak on scratch tree failure Tian Xuechen
@ 2026-12-04 13:31 ` Tian Xuechen
2026-12-05 0:06 ` ✗ LGCI.VerificationFailed: failure for drm-i915: Fix resource lifetime and error-unwind issues Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Tian Xuechen @ 2026-12-04 13:31 UTC (permalink / raw)
To: zhenyuw.linux
Cc: zhi.wang.linux, jani.nikula, joonas.lahtinen, rodrigo.vivi,
tursulin, airlied, simona, ping.a.gao, intel-gfx, dri-devel,
linux-kernel, matthew.auld, thomas.hellstrom
mock_region_create() reserves an ID before creating the memory region.
Early construction failures do not call the release callback, leaking
that ID. Later memtest failures do call release, so unconditionally
freeing the ID again in the caller would double-free it.
Keep ID ownership in the caller during construction and transfer it to
the normal release callback only after successful creation.
This issue was found by our static analysis tool under development.
Fixes: d148738923fd ("drm/i915/ttm Initialize the ttm device and memory managers")
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/gpu/drm/i915/selftests/mock_region.c | 22 ++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/selftests/mock_region.c b/drivers/gpu/drm/i915/selftests/mock_region.c
index 6324eb32d4dd..debc1ba29d40 100644
--- a/drivers/gpu/drm/i915/selftests/mock_region.c
+++ b/drivers/gpu/drm/i915/selftests/mock_region.c
@@ -102,6 +102,13 @@ static const struct intel_memory_region_ops mock_region_ops = {
.init_object = mock_object_init,
};
+/* Construction failures must leave the instance ID with the caller. */
+static const struct intel_memory_region_ops mock_region_create_ops = {
+ .init = intel_region_ttm_init,
+ .release = intel_region_ttm_fini,
+ .init_object = mock_object_init,
+};
+
struct intel_memory_region *
mock_region_create(struct drm_i915_private *i915,
resource_size_t start,
@@ -110,6 +117,7 @@ mock_region_create(struct drm_i915_private *i915,
resource_size_t io_start,
resource_size_t io_size)
{
+ struct intel_memory_region *mem;
int instance = ida_alloc_max(&i915->selftest.mock_region_instances,
TTM_NUM_MEM_TYPES - TTM_PL_PRIV - 1,
GFP_KERNEL);
@@ -117,8 +125,14 @@ mock_region_create(struct drm_i915_private *i915,
if (instance < 0)
return ERR_PTR(instance);
- return intel_memory_region_create(i915, start, size, min_page_size,
- io_start, io_size,
- INTEL_MEMORY_MOCK, instance,
- &mock_region_ops);
+ mem = intel_memory_region_create(i915, start, size, min_page_size,
+ io_start, io_size,
+ INTEL_MEMORY_MOCK, instance,
+ &mock_region_create_ops);
+ if (IS_ERR(mem))
+ ida_free(&i915->selftest.mock_region_instances, instance);
+ else
+ mem->ops = &mock_region_ops;
+
+ return mem;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/i915/gvt: Fix potential GGTT leak on scratch tree failure
2026-12-04 13:31 ` [PATCH 1/2] drm/i915/gvt: Fix potential GGTT leak on scratch tree failure Tian Xuechen
@ 2026-12-04 13:49 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-04 13:49 UTC (permalink / raw)
To: Tian Xuechen; +Cc: intel-gfx, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/i915/gvt: Fixes trailer cites wrong commit for
intel_vgpu_init_gtt()
--
commit 37afa0fbc147ef261c23b7fd66c1a3c2c27b4eb5
Author: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> drm/i915/gvt: Fix potential GGTT leak on scratch tree failure
>
> GGTT allocation precedes scratch page-tree creation. If the latter fails,
> its local unwind releases only scratch pages, and the outer vGPU unwind
> skips GTT cleanup because initialization did not succeed.
>
> Drop the newly created GGTT and clear its pointer on this failure.
>
> This issue was found by our static analysis tool under development.
>
> Fixes: 3b6411c2c205 ("drm/i915/gvt: implement scratch page table tree for shadow PPGTT")
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
[Severity: Low]
Should the Fixes tag cite 19e6393fb536 ("drm/i915/gvt: do not ignore return
value of create_scratch_page") instead?
That commit introduced the gtt->ggtt_mm leak by changing intel_vgpu_init_gtt()
to return the error from create_scratch_page() without freeing gtt->ggtt_mm.
Commit 3b6411c2c205 ("drm/i915/gvt: implement scratch page table tree for
shadow PPGTT") only replaced create_scratch_page() with
create_scratch_page_tree() on that existing error path.
Fixes: 19e6393fb536 ("drm/i915/gvt: do not ignore return value of create_scratch_page")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204133112.1953285-1-202300460064@mail.sdu.edu.cn?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* ✗ LGCI.VerificationFailed: failure for drm-i915: Fix resource lifetime and error-unwind issues
2026-12-04 13:31 [PATCH 0/2] drm-i915: Fix resource lifetime and error-unwind issues Tian Xuechen
2026-12-04 13:31 ` [PATCH 1/2] drm/i915/gvt: Fix potential GGTT leak on scratch tree failure Tian Xuechen
2026-12-04 13:31 ` [PATCH 2/2] drm/i915/selftests: Fix potential instance ID leak Tian Xuechen
@ 2026-12-05 0:06 ` Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2026-12-05 0:06 UTC (permalink / raw)
To: Tian Xuechen; +Cc: intel-gfx
== Series Details ==
Series: drm-i915: Fix resource lifetime and error-unwind issues
URL : https://patchwork.freedesktop.org/series/180570/
State : failure
== Summary ==
Series author address '202300460064@mail.sdu.edu.cn' is not on the allowlist, which prevents CI from being automatically triggered.
If you want CI to run for this series, ask Patchwork project owners to click 'retest' on the series in Patchwork.
Exception occurred during validation, bailing out!
Build URL: http://gfx-ci.igk.intel.com:8080/job/CI_PW_kernel/195107/ (on built-in)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-05 0:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 13:31 [PATCH 0/2] drm-i915: Fix resource lifetime and error-unwind issues Tian Xuechen
2026-12-04 13:31 ` [PATCH 1/2] drm/i915/gvt: Fix potential GGTT leak on scratch tree failure Tian Xuechen
2026-12-04 13:49 ` sashiko-bot
2026-12-04 13:31 ` [PATCH 2/2] drm/i915/selftests: Fix potential instance ID leak Tian Xuechen
2026-12-05 0:06 ` ✗ LGCI.VerificationFailed: failure for drm-i915: Fix resource lifetime and error-unwind issues Patchwork
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.