From: Neil Armstrong <neil.armstrong@linaro.org>
To: Jonas Karlman <jonas@kwiboo.se>,
Kevin Hilman <khilman@baylibre.com>,
Heiko Stuebner <heiko@sntech.de>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Sam Ravnborg <sam@ravnborg.org>
Cc: dri-devel@lists.freedesktop.org,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH 02/13] drm/meson: dw-hdmi: Protect from possible NULL pointer dereference
Date: Tue, 19 May 2026 09:23:35 +0200 [thread overview]
Message-ID: <6db86d54-b463-49bb-ae7f-35c694e624bc@linaro.org> (raw)
In-Reply-To: <20260518194744.2483580-3-jonas@kwiboo.se>
On 5/18/26 21:47, Jonas Karlman wrote:
> The IRQ handler can be called at any time after the call to
> devm_request_threaded_irq() completes, even before dw_hdmi->bridge has
> been assigned later in meson_dw_hdmi_bind().
>
> Protect from a possible NULL pointer dereference in IRQ handler by only
> calling drm_helper_hpd_irq_event() when bridge has been assigned.
>
> Fixes: e67f6037ae1b ("drm/meson: split out encoder from meson_dw_hdmi")
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
> ---
> I only observed this NULL pointer dereference one time, without being
> able to reliably re-create a similar timing scenario. I still think this
> is an issue that possible could happen and likely should be fixed.
>
> Note that patches later in this series will fully replace this change.
> ---
> drivers/gpu/drm/meson/meson_dw_hdmi.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 993f6d5d4b29..eafe7daf6ff1 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -520,7 +520,8 @@ static irqreturn_t dw_hdmi_top_thread_irq(int irq, void *dev_id)
> u32 stat = dw_hdmi->irq_stat;
>
> /* HPD Events */
> - if (stat & (HDMITX_TOP_INTR_HPD_RISE | HDMITX_TOP_INTR_HPD_FALL)) {
> + if (stat & (HDMITX_TOP_INTR_HPD_RISE | HDMITX_TOP_INTR_HPD_FALL) &&
> + dw_hdmi->bridge) {
> bool hpd_connected = false;
>
> if (stat & HDMITX_TOP_INTR_HPD_RISE)
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Thanks,
Neil
next prev parent reply other threads:[~2026-05-19 7:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 19:47 [PATCH 00/13] drm/meson: dw-hdmi: Misc cleanup and use CEC notifier helpers Jonas Karlman
2026-05-18 19:47 ` [PATCH 01/13] drm/meson: dw-hdmi: Report connector status based on HPD bit Jonas Karlman
2026-05-19 7:23 ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 02/13] drm/meson: dw-hdmi: Protect from possible NULL pointer dereference Jonas Karlman
2026-05-19 7:23 ` Neil Armstrong [this message]
2026-05-18 19:47 ` [PATCH 03/13] drm/meson: dw-hdmi: Call dw_hdmi_remove() consistently Jonas Karlman
2026-05-19 7:24 ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 04/13] drm/meson: dw-hdmi: Drop call to drm_bridge_hpd_notify() Jonas Karlman
2026-05-19 7:25 ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 05/13] drm/meson: encoder_hdmi: Use CEC phys addr from display_info Jonas Karlman
2026-05-19 6:36 ` Hans Verkuil
2026-05-19 7:27 ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 06/13] drm/meson: encoder_hdmi: Use bridge connector CEC notifier Jonas Karlman
2026-05-19 6:38 ` Hans Verkuil
2026-05-19 7:30 ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 07/13] drm/meson: encoder_hdmi: Report ycbcr_420_allowed from encoder Jonas Karlman
2026-05-19 7:31 ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 08/13] drm/meson: dw-hdmi: Use local dev variable consistently in bind() Jonas Karlman
2026-05-19 7:33 ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 09/13] drm/meson: dw-hdmi: Use devm_clk_get_enabled() helper Jonas Karlman
2026-05-19 7:33 ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 10/13] drm/meson: dw-hdmi: Use dev_err_probe() to report errors Jonas Karlman
2026-05-19 7:34 ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 11/13] drm/bridge: dw-hdmi: Export dw_hdmi_schedule_hpd_work() helper Jonas Karlman
2026-05-18 19:47 ` [PATCH 12/13] drm/meson: dw-hdmi: Use " Jonas Karlman
2026-05-18 19:47 ` [PATCH 13/13] drm/meson: dw-hdmi: Use suspend_late/resume_early/resume_noirq pm ops Jonas Karlman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6db86d54-b463-49bb-ae7f-35c694e624bc@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=jbrunet@baylibre.com \
--cc=jonas@kwiboo.se \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=mripard@kernel.org \
--cc=sam@ravnborg.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox