• Rob Clark's avatar
    drm/atomic: fix self-refresh helpers crtc state dereference · 86de88cf
    Rob Clark authored
    drm_self_refresh_helper_update_avg_times() was incorrectly accessing the
    new incoming state after drm_atomic_helper_commit_hw_done().  But this
    state might have already been superceeded by an !nonblock atomic update
    resulting in dereferencing an already free'd crtc_state.
    
    TODO I *think* this will more or less do the right thing.. althought I'm
    not 100% sure if, for example, we enter psr in a nonblock commit, and
    then leave psr in a !nonblock commit that overtakes the completion of
    the nonblock commit.  Not sure if this sort of scenario can happen in
    practice.  But not crashing is better than crashing, so I guess we
    should either take this patch or rever the self-refresh helpers until
    Sean can figure out a better solution.
    
    Fixes: d4da4e33 ("drm: Measure Self Refresh Entry/Exit times to avoid thrashing")
    Cc: Sean Paul <seanpaul@chromium.org>
    Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
    [seanpaul fixed up some checkpatch warns]
    Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20191104173737.142558-1-robdclark@gmail.com
    86de88cf
drm_atomic_helper.c 107 KB