exynos_plane_mode_set() computes the scaling ratio as exynos_state->h_ratio = (src_w << 16) / crtc_w; exynos_state->v_ratio = (src_h << 16) / crtc_h; crtc_w/crtc_h are taken directly from the userspace atomic plane state. drm_atomic_plane_check() only bounds them from above (against INT_MAX), never rejects zero, so a DRM atomic commit with CRTC_W or CRTC_H set to 0 reaches this division and raises a divide error. The check runs before exynos_drm_plane_check_size() as well. Reject a zero destination size in exynos_plane_atomic_check(). Fixes: 3cabaf7ea704 ("drm/exynos: add ratio calculation") Signed-off-by: Shirong Zhao --- drivers/gpu/drm/exynos/exynos_drm_plane.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 020e8c9..285ce08 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -238,6 +238,13 @@ static int exynos_plane_atomic_check(struct drm_plane *plane, if (!new_plane_state->crtc || !new_plane_state->fb) return 0; + /* + * A zero destination width/height divides by zero in + * exynos_plane_mode_set(); the DRM core only bounds these from above. + */ + if (!new_plane_state->crtc_w || !new_plane_state->crtc_h) + return -EINVAL; + /* translate state into exynos_state */ exynos_plane_mode_set(exynos_state); -- 2.53.0