⬢ DragonFlyBSD Kernel Audit
DF-4187 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/radeon/sumo_dpm.c
+++ b/sys/dev/drm/radeon/sumo_dpm.c
@@ -1206,6 +1206,15 @@
 {
 	struct sumo_power_info *pi = sumo_get_pi(rdev);
 
+	/* DF-4187: the VBIOS power table may contain no BOOT-classified
+	 * state (or dpm.init may have failed and radeon_pm swallowed it),
+	 * leaving boot_ps NULL.  Refuse to enable instead of page-faulting
+	 * in sumo_update_current_ps(rdev, NULL) below. */
+	if (rdev->pm.dpm.boot_ps == NULL) {
+		DRM_ERROR("no boot power state, refusing to enable DPM\n");
+		return -EINVAL;
+	}
+
 	if (sumo_dpm_enabled(rdev))
 		return -EINVAL;
 
@@ -1263,6 +1272,8 @@
 
 	if (!sumo_dpm_enabled(rdev))
 		return;
+	if (rdev->pm.dpm.boot_ps == NULL)	/* DF-4187 */
+		return;
 	sumo_disable_clock_power_gating(rdev);
 	if (pi->enable_sclk_ds)
 		sumo_enable_sclk_ds(rdev, false);