⬢ DragonFlyBSD Kernel Audit
DF-4272 / fix.diff
← back to finding ↓ download raw
fix.diff - DF-4272: NULL-check res_pool->pp_smu in dcn_bw_notify_pplib_of_wm_ranges().

dcn10_pp_smu_create() (dcn10_resource.c:858-865) returns NULL on kzalloc
failure and its result is stored at dcn10_resource.c:1352 without a check;
dcn_bw_notify_pplib_of_wm_ranges() then dereferences pp->set_wm_ranges at
dcn_calcs.c:1406 -> NULL pointer read / probe-time panic on DCN1 (Raven)
systems under memory pressure.

Applies on top of sys/dev/drm/amd/display/dc/calcs/dcn_calcs.c (read-only
audit tree; never applied).

--- a/sys/dev/drm/amd/display/dc/calcs/dcn_calcs.c
+++ b/sys/dev/drm/amd/display/dc/calcs/dcn_calcs.c
@@ -1403,7 +1403,8 @@ void dcn_bw_notify_pplib_of_wm_ranges(struct dc *dc)
 	const int overdrive = 5000000; /* 5 GHz to cover Overdrive */
 
-	if (!pp->set_wm_ranges)
+	if (!pp || !pp->set_wm_ranges)
 		return;
 
 	kernel_fpu_begin();