⬢ DragonFlyBSD Kernel Audit
DF-4729 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/i915/intel_guc.c
+++ b/sys/dev/drm/i915/intel_guc.c
@@ -293,9 +293,19 @@
 
 static u32 guc_ctl_log_params_flags(struct intel_guc *guc)
 {
-	u32 offset = intel_guc_ggtt_offset(guc, guc->log.vma) >> PAGE_SHIFT;
+	u32 offset;
 	u32 flags;
 
+	/*
+	 * This port compiles out intel_guc_log_create() (see the #if 0 in
+	 * intel_guc_init), so guc->log.vma is always NULL.  Do not hand the
+	 * firmware a bogus log-params dword, and do not dereference NULL.
+	 */
+	if (!guc->log.vma)
+		return 0;
+
+	offset = intel_guc_ggtt_offset(guc, guc->log.vma) >> PAGE_SHIFT;
+
 	#if (((CRASH_BUFFER_SIZE) % SZ_1M) == 0)
 	#define UNIT SZ_1M
 	#define FLAG GUC_LOG_ALLOC_IN_MEGABYTE