⬢ DragonFlyBSD Kernel Audit
DF-5230 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/radeon/uvd_v4_2.c
+++ b/sys/dev/drm/radeon/uvd_v4_2.c
@@ -40,6 +40,17 @@
 	uint64_t addr;
 	uint32_t size;
 
+	/*
+	 * UVD firmware not loaded (CIK APU with DPM enabled but the
+	 * radeonkmsfw UVD kmods absent): kv_dpm_powergate_uvd(rdev, false)
+	 * reaches here with uvd_fw == NULL (kv_dpm.c:1628) and used to
+	 * dereference it below.  cik_uvd_start() already guards with
+	 * has_uvd (cik.c:8167) and radeon_uvd_resume() with vcpu_bo ==
+	 * NULL (radeon_uvd.c:286); mirror that for the DPM ungate path.
+	 */
+	if (rdev->uvd_fw == NULL)
+		return -EINVAL;
+
 	/* programm the VCPU memory controller bits 0-27 */
 
 	/* skip over the header of the new firmware format */