DragonFlyBSD Kernel Audit
DF-1587 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/sys/dev/drm/amd/powerplay/hwmgr/vega10_processpptables.c
--- a/sys/dev/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/sys/dev/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -778,6 +778,17 @@
 	if (!pcie_table)
 		return -ENOMEM;
 
+	/*
+	 * DF-1587: pp_table_info->vdd_dep_on_sclk is only populated when
+	 * usGfxclkDependencyTableOffset != 0.  A VBIOS that has a PCIE
+	 * table but no GFXCLK dependency table would NULL-deref on the
+	 * count read below.
+	 */
+	if (!table_info->vdd_dep_on_sclk) {
+		kfree(pcie_table);
+		return -EINVAL;
+	}
+
 	pcie_count = table_info->vdd_dep_on_sclk->count;
 	if (atom_pcie_table->ucNumEntries <= pcie_count)
 		pcie_count = atom_pcie_table->ucNumEntries;