public inbox for dri-devel@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/gpuvm: Do not prepare NULL objects
@ 2026-01-30 19:19 Jonathan Cavitt
  2026-02-24 15:41 ` Krzysztof Karas
  2026-04-16 20:01 ` Danilo Krummrich
  0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Cavitt @ 2026-01-30 19:19 UTC (permalink / raw)
  To: dri-devel
  Cc: saurabhg.gupta, alex.zuo, jonathan.cavitt, matthew.brost,
	thomas.hellstrom

Statis analysis issue:

drm_gpuvm_prepare_range issues an exec_object_prepare call to all
drm_gem_objects mapped between addr and addr + range.  However, it is
possible (albeit very unlikely) that the objects found through
drm_gpuvm_for_each_va_range (as connected to va->gem) are NULL, as seen
in other functions such as drm_gpuva_link and drm_gpuva_unlink_defer.

Do not prepare NULL objects.

Fixes: 50c1a36f594b ("drm/gpuvm: track/lock/validate external/evicted objects")
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/drm_gpuvm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_gpuvm.c b/drivers/gpu/drm/drm_gpuvm.c
index 14469765a780..76f70686f0e6 100644
--- a/drivers/gpu/drm/drm_gpuvm.c
+++ b/drivers/gpu/drm/drm_gpuvm.c
@@ -1322,6 +1322,9 @@ drm_gpuvm_prepare_range(struct drm_gpuvm *gpuvm, struct drm_exec *exec,
 	drm_gpuvm_for_each_va_range(va, gpuvm, addr, end) {
 		struct drm_gem_object *obj = va->gem.obj;
 
+		if (unlikely(!obj))
+			continue;
+
 		ret = exec_prepare_obj(exec, obj, num_fences);
 		if (ret)
 			return ret;
-- 
2.43.0


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

end of thread, other threads:[~2026-04-17  4:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-30 19:19 [PATCH] drm/gpuvm: Do not prepare NULL objects Jonathan Cavitt
2026-02-24 15:41 ` Krzysztof Karas
2026-04-16 20:01 ` Danilo Krummrich
2026-04-16 20:23   ` Cavitt, Jonathan
2026-04-16 20:44     ` Danilo Krummrich
2026-04-17  4:20       ` Luben Tuikov

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