diff --git a/sys/dev/drm/drm_modes.c b/sys/dev/drm/drm_modes.c --- a/sys/dev/drm/drm_modes.c +++ b/sys/dev/drm/drm_modes.c @@ -1126,6 +1126,10 @@ mode->vtotal < mode->vsync_end) return MODE_V_ILLEGAL; + /* vscan multiplies crtc_v*; cap to avoid signed int overflow */ + if (mode->vscan > 1 && mode->vscan > UINT_MAX / max(mode->vtotal, 1U)) + return MODE_V_ILLEGAL; + return MODE_OK; }