⬢ DragonFlyBSD Kernel Audit
DF-4118 / fix.diff
← back to finding ↓ download raw
Fix for DF-4118: reject enable/disable when the VBIOS power table produced no BOOT-classified state (rdev->pm.dpm.boot_ps == NULL) instead of dereferencing it via rv770_get_ps().

--- a/sys/dev/drm/radeon/cypress_dpm.c
+++ b/sys/dev/drm/radeon/cypress_dpm.c
@@ -1811,6 +1811,11 @@
 	struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps;
 	int ret;
 
+	if (boot_ps == NULL) {
+		DRM_ERROR("no boot state in power table\n");
+		return -EINVAL;
+	}
+
 	if (pi->gfx_clock_gating)
 		rv770_restore_cgcg(rdev);
 
@@ -1924,6 +1929,11 @@
 	if (!rv770_dpm_enabled(rdev))
 		return;
 
+	if (boot_ps == NULL) {
+		DRM_ERROR("no boot state in power table\n");
+		return;
+	}
+
 	rv770_clear_vc(rdev);
 
 	if (pi->thermal_protection)