diff --git a/sys/dev/drm/amd/powerplay/smumgr/ci_smumgr.c b/sys/dev/drm/amd/powerplay/smumgr/ci_smumgr.c --- a/sys/dev/drm/amd/powerplay/smumgr/ci_smumgr.c +++ b/sys/dev/drm/amd/powerplay/smumgr/ci_smumgr.c @@ -2159,6 +2159,15 @@ t_diff1 = hwmgr->thermal_controller.advanceFanControlParameters.usTMed - hwmgr->thermal_controller.advanceFanControlParameters.usTMin; t_diff2 = hwmgr->thermal_controller.advanceFanControlParameters.usTHigh - hwmgr->thermal_controller.advanceFanControlParameters.usTMed; + /* DF-1297: VBIOS-controlled temperature deltas must be non-zero before + * being used as divisors, otherwise a crafted/faulty VBIOS + * (usTMed==usTMin or usTHigh==usTMed) triggers a divide-by-zero #DE panic. */ + if (t_diff1 == 0 || t_diff2 == 0) { + phm_cap_unset(hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_MicrocodeFanControl); + return -EINVAL; + } + pwm_diff1 = hwmgr->thermal_controller.advanceFanControlParameters.usPWMMed - hwmgr->thermal_controller.advanceFanControlParameters.usPWMMin; pwm_diff2 = hwmgr->thermal_controller.advanceFanControlParameters.usPWMHigh - hwmgr->thermal_controller.advanceFanControlParameters.usPWMMed;