sun4i_frontend_update_coord(), reached through the frontend path, computes the scaler factors as (luma_width << 16) / state->crtc_w (luma_height << 16) / state->crtc_h state->crtc_w/crtc_h are the userspace atomic plane destination size. The DRM core only bounds them from above, and nothing in the sun4i backend rejects zero, so a commit with a zero destination size divides by zero. Reject zero-sized layers in sun4i_backend_plane_is_supported(). Fixes: dd0421f47505 ("drm/sun4i: Add a driver for the display frontend") Signed-off-by: Shirong Zhao --- drivers/gpu/drm/sun4i/sun4i_backend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index f01ab79..0b6505d 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -442,6 +442,13 @@ static bool sun4i_backend_plane_uses_frontend(struct drm_plane_state *state) static bool sun4i_backend_plane_is_supported(struct drm_plane_state *state, bool *uses_frontend) { + /* + * sun4i_frontend_update_coord() divides by crtc_w/crtc_h, and the DRM + * core does not reject a zero destination size. + */ + if (!state->crtc_w || !state->crtc_h) + return false; + if (sun4i_backend_plane_uses_frontend(state)) { *uses_frontend = true; return true; -- 2.53.0