From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 388F6606A681 for ; Sat, 5 Dec 2026 02:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O8XMoiUK Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4ABE10E097; Sat, 5 Dec 2026 02:34:08 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 927B910E097 for ; Sat, 5 Dec 2026 02:34:02 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5789A43A33; Sat, 5 Dec 2026 02:34:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 128B31F00936; Sat, 5 Dec 2026 02:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796438042; bh=suqTL/ISZ4FTZBzfIjCW6IG4yFkJRYzkSg4lDhkP2p0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=O8XMoiUKUH+XohlsM9Vc+KsqD/tBtDCHvV0DvksLuDX2CQPbOO8sUHtYnUJcFsGMx Su0iXSyEgPbUC2xXM5oFF08Z9RsfkpKuBoR62Y1QwzUqw0fS6hdUOg5jCv7hsvNEe/ pPnlNVrDWjY+oekVlc/o3wMAgQksV3UaJbcNbpG/fCEvSVuFyP5i90z0t8h8Ze40ee Rre+W1RyydrNXpQvWtq0ZK66DrRyceH4v4mkNhPGcgTV8cI+hlQGg5YUctZ80EAajn Isdglcg2Q1Jj3l+nkkyIkDursMGARfnE6Ek7sQ+tXs3vqb6dhdxYsEqLbaczrdcwmN ISb99RB+Uyp3A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/meson: skip invisible planes in atomic_update To: "Shirong Zhao" Cc: dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org In-Reply-To: <20261205021754.64-1-shxzhaosr@163.com> References: <20261205021754.64-1-shxzhaosr@163.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 02:34:01 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] drm/meson: invisible plane skip leaves OSD1 enabled causing DMA UAF - [Low] drm/meson: Fixes tag cites bbbe775ec5b5 instead of 7db647aa8b13 -- commit 2897024e4c3710997999b1de11959966a195a61b Author: Shirong Zhao > drm/meson: skip invisible planes in atomic_update > > meson_plane_atomic_update() computes the scaler phase steps as > > hf_phase_step =3D ((src_w << 18) / dst_w) << 6; > vf_phase_step =3D (src_h << 20) / dst_h; > > without checking new_state->visible. When userspace submits a zero > destination size through the atomic ioctl, > drm_atomic_helper_check_plane_state() marks the plane invisible but > drm_atomic_helper_commit_planes() still calls ->atomic_update() for a > plane that keeps its CRTC, so dst_w/dst_h can be 0 and the divisions > above raise a divide error. > > Return early for an invisible plane. > > Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controll= er") > Signed-off-by: Shirong Zhao [Severity: Low] Should the Fixes tag cite 7db647aa8b13 ("drm/meson: Add primary plane scaling") instead? Commit bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller") did not have the scaler phase-step divisions by dst_w and dst_h. > diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/= meson_plane.c > index c17afe6712f93..80d685b875a74 100644 > --- a/drivers/gpu/drm/meson/meson_plane.c > +++ b/drivers/gpu/drm/meson/meson_plane.c > @@ -152,6 +152,15 @@ static void meson_plane_atomic_update(struct drm_pla= ne *plane, > int vf_bank_len; > u8 canvas_id_osd1; > =20 > + /* > + * A zero destination size makes the plane invisible, but > + * drm_atomic_helper_commit_planes() still calls ->atomic_update() for > + * planes that keep their CRTC. The scaler factor computation below > + * divides by dst_w/dst_h, so bail out for an invisible plane. > + */ > + if (!new_state->visible) > + return; > + > /* > * Update Coordinates > * Update Formats [Severity: High] Does returning early here leave OSD1 enabled and scanning out the previous framebuffer's DMA address? When a visible plane becomes invisible while keeping its CRTC, drm_atomic_helper_commit_planes() skips ->atomic_disable() and calls meson_plane_atomic_update() instead. Bailing out leaves priv->viu.osd1_enabled true and priv->viu.osd1_addr set to the old buffer. meson_crtc_atomic_flush() then still sets priv->viu.osd1_commit, so meson_crtc_irq() keeps programming OSD1 with that stale address. If the commit replaced the framebuffer, freeing the old GEM buffer results in a DMA use-after-free while OSD1 continues scanning it out. Calling meson_plane_atomic_disable(plane, state) before returning would disable OSD1 and clear priv->viu.osd1_enabled. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205021754.64-1= -shxzhaosr@163.com?part=3D1