summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2020-07-09 10:45:36 +0000
committerjsg <jsg@openbsd.org>2020-07-09 10:45:36 +0000
commit0d0adde2ba5dfe73011abddbcf412376e3f28491 (patch)
tree49c159f1277ed591c2d70605d8d97615b9d40f0a /sys/dev
parentAvoid NULL deref in regexec when searching for empty lines. (diff)
downloadwireguard-openbsd-0d0adde2ba5dfe73011abddbcf412376e3f28491.tar.xz
wireguard-openbsd-0d0adde2ba5dfe73011abddbcf412376e3f28491.zip
drm/amd/powerplay: Fix NULL dereference in lock_bus() on Vega20 w/o RAS
From Ivan Mironov 13b2fe391cac70c7746e2cb68e73d99002f1cd00 in linux 5.7.y/5.7.8 7e89e4aaa9ae83107d059c186955484b3aa6eb23 in mainline linux
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/amd/powerplay/smumgr/vega20_smumgr.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/amd/powerplay/smumgr/vega20_smumgr.c b/sys/dev/pci/drm/amd/powerplay/smumgr/vega20_smumgr.c
index 16aa171971d..f1e7024c508 100644
--- a/sys/dev/pci/drm/amd/powerplay/smumgr/vega20_smumgr.c
+++ b/sys/dev/pci/drm/amd/powerplay/smumgr/vega20_smumgr.c
@@ -508,9 +508,11 @@ static int vega20_smu_init(struct pp_hwmgr *hwmgr)
priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].version = 0x01;
priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size = sizeof(DpmActivityMonitorCoeffInt_t);
- ret = smu_v11_0_i2c_eeprom_control_init(&adev->pm.smu_i2c);
- if (ret)
- goto err4;
+ if (adev->psp.ras.ras) {
+ ret = smu_v11_0_i2c_eeprom_control_init(&adev->pm.smu_i2c);
+ if (ret)
+ goto err4;
+ }
return 0;
@@ -546,7 +548,8 @@ static int vega20_smu_fini(struct pp_hwmgr *hwmgr)
(struct vega20_smumgr *)(hwmgr->smu_backend);
struct amdgpu_device *adev = hwmgr->adev;
- smu_v11_0_i2c_eeprom_control_fini(&adev->pm.smu_i2c);
+ if (adev->psp.ras.ras)
+ smu_v11_0_i2c_eeprom_control_fini(&adev->pm.smu_i2c);
if (priv) {
amdgpu_bo_free_kernel(&priv->smu_tables.entry[TABLE_PPTABLE].handle,