• Ilija Hadzic's avatar
    drm: eliminate bit-copy restoration of crtc · 02ee4e94
    Ilija Hadzic authored
    Bit-copying restoration of CRTC structure in failure-recovery
    path of drm_crtc_helper_set_config function evokes a
    subtle and rare, but very dangerous, corruption of
    CRTC mutex structure.
    
    Namely, if drm_crtc_helper_set_config takes the path under
    'fail:' label *and* some other process has attempted to
    grab the crtc mutex (and got blocked), restoring the CRTC
    structure by bit-copying it will overwrite the CRTC mutex
    state and the waiters list pointer within the mutex structure.
    Consequently the blocked process will never be scheduled.
    
    This patch fixes the issue by eliminating the bit-copy
    restoration. The elimination is possible because previous
    patches have cleaned up the resoration path so that only
    the fields touched by the drm_crtc_helper_set_config function
    are saved and restored if necessary.
    Signed-off-by: default avatarIlija Hadzic <ihadzic@research.bell-labs.com>
    Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
    02ee4e94
drm_crtc_helper.c 32.8 KB