Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796039630; b=UUgSqfVPK6iuueWqQdMFLX/RYGZuOWIbJoxFtXpPftP8VHKRpUwP+hizHopf/OssHD+t WyT4Hz9FYnJhQt8DcjE0eMOfcu0dQ2L4a1Edio4f3hIxzaJQ8f4TaSW6EHgMKhWCH7y1H 70yDTtSK+LjvEUsRMZbLWGm3egQY7rCa2hyzOQlfFf+MRvX4l8iUQ+W/dC7oH7g60w2Dl 0rrQ+s2uJVDaMoHGHnQnEd1CXJCpBV32VlR44sXquuOudnDXX8vOIF6T6UOlTr5rDXliW C4WqKaSVD/ANrPgn6W8pXD88Dzp80qdioOxKpwPUAFXUAhK7IFREF+qXR3+Cq3oiH8A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796039630; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=YrLW5cDvWYWe9GvzpmnWfvo1nA9QYMnyB4zqX5S+B6s=; b=35yjBfewy++SkAtgLRcerLsshYQD0qRI6Q7vqwr8eq9XEuyiEmCsxeqORhVE8xseO8qo xL2YsCOlgnRxGHKyL6H2qraBldXnl5iTYt76/+7VmGGahO4a42HiVsOKf/unMwAnHCRNr uAdZ3Wp4B7HRbu3IDYiH8yzqj9anDR/r0TwcjvOrHt2B1IcsCILzzhqjwfAj5T5Bgyaqn jmSA1J0Tr/iL5vir5mYdicn6iNuZ7Esaleff+X7zzEdfvJpIJDTB8DaNJIjiBxnsvDIqY XFYcgFY0DW7IbnJje98rQfKj1y2skIqqicENTEQ+36iBdt97xvECAEsmCaatK91VFNg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=B1Ykk96W; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10E13606A33D for ; Mon, 30 Nov 2026 11:53:49 +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=B1Ykk96W Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D6C61F00897; Mon, 30 Nov 2026 11:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796039629; bh=YrLW5cDvWYWe9GvzpmnWfvo1nA9QYMnyB4zqX5S+B6s=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=B1Ykk96WLFjECf7At67eBIqcrlTyog8lA3TgdEWyJdQGu0qengt70RcOjbcTKqXRM mrcQA1BzfeykL1oh2j+Fb7ySxBES/0yIk6OUQyyrpJtlegI0+IXvzU841DNdzWhTsq k4HOw6W+b6mfdx4PZFGrwIID8f9j3JBqM8MoefHyg3b0OM4+EAKc1Q1rHP9E3AYbRx miF8SRYR7WQQ8lOHYojzrE+i6/lYUHslAQRrQWAxfZYoAR0D4Tvq6RH6BKAPg4crJB +3PhP44+EvFHd/FvFdA15hDxBlwA+VY4gnmeKJWEMgDuZ5iZBuIeh7uaZgVIT/+wWK meVWxGmTsM5lg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v9 09/13] drm/tegra: Convert to use atomic versions of drm_encoder_helper_funcs Reply-To: sashiko-reviews@lists.linux.dev To: "Svyatoslav Ryhel" Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261130114155.72920-10-clamor95@gmail.com> References: <20261130114155.72920-1-clamor95@gmail.com> <20261130114155.72920-10-clamor95@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 11:53:48 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] drm/tegra: NULL dereference from new state lookup in atomic_disable() - [Low] drm/tegra: redundant tegra_dsi_get_state() in tegra_dsi_encoder_enable() -- commit 74ebbfecbca273aa0938d93154bb9f25f3ba63aa Author: Svyatoslav Ryhel drm/tegra: Convert to use atomic versions of drm_encoder_helper_funcs This commit converts the Tegra DSI, HDMI, RGB, and SOR encoder helpers from the legacy enable() and disable() callbacks to atomic_enable() and atomic_disable(). > diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c > index 6d6adc485e51e..dd3fc09f57487 100644 > --- a/drivers/gpu/drm/tegra/dsi.c > +++ b/drivers/gpu/drm/tegra/dsi.c [ ... ] > @@ -855,14 +863,21 @@ static void tegra_dsi_unprepare(struct tegra_dsi *d= si) > dev_err(dsi->dev, "failed to suspend: %d\n", err); > } > =20 > -static void tegra_dsi_encoder_disable(struct drm_encoder *encoder) > +static void tegra_dsi_encoder_disable(struct drm_encoder *encoder, > + struct drm_atomic_commit *comm_state) > { > struct tegra_output *output =3D encoder_to_output(encoder); > - struct tegra_dc *dc =3D to_tegra_dc(encoder->crtc); > struct tegra_dsi *dsi =3D to_dsi(output); > + struct drm_connector_state *conn_state; > + struct drm_connector *connector; > + struct tegra_dc *dc; > u32 value; > int err; > =20 > + connector =3D drm_atomic_get_new_connector_for_encoder(comm_state, enco= der); > + conn_state =3D drm_atomic_get_new_connector_state(comm_state, connector= ); > + dc =3D to_tegra_dc(conn_state->crtc); [Severity: High] Does looking up the new connector state in atomic_disable() cause a NULL pointer dereference when disabling an output? When an output is disabled, update_connector_routing() clears new_conn_state->best_encoder to NULL before the commit phase runs atomic_disable(). drm_atomic_get_new_connector_for_encoder() then returns NULL, and drm_atomic_get_new_connector_state() dereferences connector->inde= x. Even if the connector were being moved to another CRTC, the new state would point to the new CRTC rather than the old CRTC that was driving this encode= r. The same regression is present in tegra_hdmi_encoder_disable(), tegra_sor_hdmi_disable(), and tegra_sor_dp_disable(). These disable callbacks should query the old state via drm_atomic_get_old_connector_for_encoder() and drm_atomic_get_old_connector_state() (or drm_atomic_get_old_crtc_for_encode= r()). > @@ -919,16 +934,26 @@ static int tegra_dsi_prepare(struct tegra_dsi *dsi) > return 0; > } > =20 > -static void tegra_dsi_encoder_enable(struct drm_encoder *encoder) > +static void tegra_dsi_encoder_enable(struct drm_encoder *encoder, > + struct drm_atomic_commit *comm_state) > { > - struct drm_display_mode *mode =3D &encoder->crtc->state->adjusted_mode; > struct tegra_output *output =3D encoder_to_output(encoder); > - struct tegra_dc *dc =3D to_tegra_dc(encoder->crtc); > struct tegra_dsi *dsi =3D to_dsi(output); > + struct drm_connector_state *conn_state; > + struct drm_crtc_state *crtc_state; > + struct drm_connector *connector; > struct tegra_dsi_state *state; > + struct drm_display_mode *mode; > + struct tegra_dc *dc; > u32 value; > int err; > =20 > + connector =3D drm_atomic_get_new_connector_for_encoder(comm_state, enco= der); > + conn_state =3D drm_atomic_get_new_connector_state(comm_state, connector= ); > + crtc_state =3D drm_atomic_get_new_crtc_state(comm_state, conn_state->cr= tc); > + dc =3D to_tegra_dc(conn_state->crtc); > + mode =3D &crtc_state->adjusted_mode; > + > err =3D tegra_dsi_prepare(dsi); > if (err < 0) { > dev_err(dsi->dev, "failed to prepare: %d\n", err); > @@ -944,7 +969,7 @@ static void tegra_dsi_encoder_enable(struct drm_encod= er *encoder) > if (value & DSI_POWER_CONTROL_ENABLE) > tegra_dsi_disable(dsi); > =20 > - state =3D tegra_dsi_get_state(dsi); > + state =3D tegra_dsi_get_state(dsi, comm_state); > =20 > tegra_dsi_set_timeout(dsi, state->bclk, state->vrefresh); > =20 > @@ -957,7 +982,7 @@ static void tegra_dsi_encoder_enable(struct drm_encod= er *encoder) > if (output->panel) > drm_panel_prepare(output->panel); > =20 > - tegra_dsi_configure(dsi, dc->pipe, mode); > + tegra_dsi_configure(dsi, dc->pipe, mode, comm_state); [Severity: Low] As reported by Mikko Perttunen on v8 [1], since tegra_dsi_encoder_enable() already retrieves conn_state via drm_atomic_get_new_connector_state(), can = it use to_dsi_state(conn_state) directly and pass struct tegra_dsi_state * into tegra_dsi_configure() so tegra_dsi_get_state() can be dropped? [1] https://lore.kernel.org/r/mxfdX1kqQz209wWYqFOofg@nvidia.com --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130114155.7292= 0-1-clamor95@gmail.com?part=3D9