From: Wentao Liang <vulab@iscas.ac.cn>
To: zhenyuw.linux@gmail.com, zhi.wang.linux@gmail.com
Cc: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
rodrigo.vivi@intel.com, tursulin@ursulin.net,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] drm/i915/gvt: Release GGTT MM if scratch page setup fails
Date: Tue, 3 Nov 2026 06:54:07 +0000 [thread overview]
Message-ID: <20261103065407.1070225-1-vulab@iscas.ac.cn> (raw)
intel_vgpu_init_gtt() creates the GGTT MM before allocating the scratch
page table tree. If scratch page allocation or DMA mapping fails,
create_scratch_page_tree() releases its own pages, but the GGTT MM and
its virtual GGTT and host GGTT buffers remain allocated. The caller
skips intel_vgpu_clean_gtt() when intel_vgpu_init_gtt() fails.
Drop the GGTT MM reference and clear its pointer before returning the
scratch page initialization error.
Fixes: 3b6411c2c205 ("drm/i915/gvt: implement scratch page table tree for shadow PPGTT")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.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
next reply other threads:[~2026-11-03 6:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 6:54 Wentao Liang [this message]
2026-11-03 7:27 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103065407.1070225-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=stable@vger.kernel.org \
--cc=tursulin@ursulin.net \
--cc=zhenyuw.linux@gmail.com \
--cc=zhi.wang.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®