drm/i915/gt: Potential error pointer dereference in pinned_context()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 13 Aug 2021 11:36:00 +0000 (14:36 +0300)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Fri, 20 Aug 2021 16:32:38 +0000 (12:32 -0400)
If the intel_engine_create_pinned_context() function returns an error
pointer, then dereferencing "ce" will Oops.  Use "vm" instead of
"ce->vm".

Fixes: cf586021642d ("drm/i915/gt: Pipelined page migration")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210813113600.GC30697@kili
drivers/gpu/drm/i915/gt/intel_migrate.c

index d0a7c93..1dac21a 100644 (file)
@@ -177,7 +177,7 @@ static struct intel_context *pinned_context(struct intel_gt *gt)
        ce = intel_engine_create_pinned_context(engine, vm, SZ_512K,
                                                I915_GEM_HWS_MIGRATE,
                                                &key, "migrate");
-       i915_vm_put(ce->vm);
+       i915_vm_put(vm);
        return ce;
 }