⬢ DragonFlyBSD Kernel Audit
DF-3889 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/amd/amdgpu/kv_dpm.c
+++ b/sys/dev/drm/amd/amdgpu/kv_dpm.c
@@ -1397,7 +1397,8 @@
 	kv_enable_ulv(adev, false);
 	kv_reset_am(adev);
 
-	kv_update_current_ps(adev, adev->pm.dpm.boot_ps);
+	if (adev->pm.dpm.boot_ps)
+		kv_update_current_ps(adev, adev->pm.dpm.boot_ps);
 }
 
 #if 0
@@ -2856,6 +2857,13 @@
 	if (ret)
 		return ret;
 
+	/* kv_parse_pplib_non_clock_info only sets boot_ps for a
+	 * BOOT-classified state; refuse to run without one. */
+	if (!adev->pm.dpm.boot_ps) {
+		DRM_ERROR("no boot state in VBIOS power table\n");
+		return -EINVAL;
+	}
+
 	pi->enable_dpm = true;
 
 	return 0;