From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com, jonathan.cavitt@intel.com
Subject: [PATCH] drm/xe: Handle NULL TTM case in xe_bo_move
Date: Tue, 16 Sep 2025 22:06:05 +0000 [thread overview]
Message-ID: <20250916220604.83613-2-jonathan.cavitt@intel.com> (raw)
It is possible for xe_bo_move to pass a NULL TTM pointer to
xe_tt_map_sg, which would result in a NULL pointer dereference.
Whether or not this issue realistically occurs, it would be good
to add an error handler to guard agains this.
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
drivers/gpu/drm/xe/xe_bo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 8422f3cab113..bfeae8fd1650 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -834,7 +834,9 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
(!ttm && ttm_bo->type == ttm_bo_type_device);
if (new_mem->mem_type == XE_PL_TT) {
- ret = xe_tt_map_sg(xe, ttm);
+ ret = -ENOENT;
+ if (ttm)
+ ret = xe_tt_map_sg(xe, ttm);
if (ret)
goto out;
}
--
2.43.0
next reply other threads:[~2025-09-16 22:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 22:06 Jonathan Cavitt [this message]
2025-09-16 22:13 ` ✓ CI.KUnit: success for drm/xe: Handle NULL TTM case in xe_bo_move Patchwork
2025-09-16 22:49 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-17 2:41 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-17 10:01 ` [PATCH] " Matthew Auld
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=20250916220604.83613-2-jonathan.cavitt@intel.com \
--to=jonathan.cavitt@intel.com \
--cc=alex.zuo@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=saurabhg.gupta@intel.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