Skip to content

Commit 9d69391

Browse files
srishanmalexdeucher
authored andcommitted
drm/amd/display: Add NULL check for stream before dereference in 'dm_vupdate_high_irq'
Add a NULL check for acrtc->dm_irq_params.stream before accessing its members. Fixes below: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:623 dm_vupdate_high_irq() warn: variable dereferenced before check 'acrtc->dm_irq_params.stream' (see line 615) 614 if (vrr_active) { 615 bool replay_en = acrtc->dm_irq_params.stream->link->replay_settings.replay_feature_enabled; ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 616 bool psr_en = acrtc->dm_irq_params.stream->link->psr_settings.psr_feature_enabled; ^^^^^^^^^^^^^^^^^^^^^^^^^^^ New dereferences 617 bool fs_active_var_en = acrtc->dm_irq_params.freesync_config.state 618 == VRR_STATE_ACTIVE_VARIABLE; 619 620 amdgpu_dm_crtc_handle_vblank(acrtc); 621 622 /* BTR processing for pre-DCE12 ASICs */ 623 if (acrtc->dm_irq_params.stream && ^^^^^^^^^^^^^^^^^^^^^^^^^^^ But the existing code assumed it could be NULL. Someone is wrong. 624 adev->family < AMDGPU_FAMILY_AI) { 625 spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags); Fixes: 6d31602 ("drm/amd/display: more liberal vmin/vmax update for freesync") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Cc: Alex Hung <alex.hung@amd.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Roman Li <roman.li@amd.com> Cc: ChiaHsuan Chung <chiahsuan.chung@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Ray Wu <ray.wu@amd.com> Cc: Daniel Wheeler <daniel.wheeler@amd.com> Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 5bf93e1 commit 9d69391

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ static void dm_vupdate_high_irq(void *interrupt_params)
611611
* page-flip completion events that have been queued to us
612612
* if a pageflip happened inside front-porch.
613613
*/
614-
if (vrr_active) {
614+
if (vrr_active && acrtc->dm_irq_params.stream) {
615615
bool replay_en = acrtc->dm_irq_params.stream->link->replay_settings.replay_feature_enabled;
616616
bool psr_en = acrtc->dm_irq_params.stream->link->psr_settings.psr_feature_enabled;
617617
bool fs_active_var_en = acrtc->dm_irq_params.freesync_config.state
@@ -620,8 +620,7 @@ static void dm_vupdate_high_irq(void *interrupt_params)
620620
amdgpu_dm_crtc_handle_vblank(acrtc);
621621

622622
/* BTR processing for pre-DCE12 ASICs */
623-
if (acrtc->dm_irq_params.stream &&
624-
adev->family < AMDGPU_FAMILY_AI) {
623+
if (adev->family < AMDGPU_FAMILY_AI) {
625624
spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);
626625
mod_freesync_handle_v_update(
627626
adev->dm.freesync_module,

0 commit comments

Comments
 (0)