All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 02/10] drm/bridge: cdns-mhdp8546: Remove redundant dev_err()
Date: Thu, 23 Jul 2026 13:29:00 +0000	[thread overview]
Message-ID: <20260723132902.7389C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260723131649.134127-3-panchuang@vivo.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

Pre-existing issues:
- [High] Use-After-Free in cdns_mhdp_remove() due to active interrupt handler rescheduling work
- [High] Uninitialized workqueue and waitqueue accessed by interrupt handler on probe
- [High] Use-After-Free due to asynchronous firmware loading timeout in cdns_mhdp_remove()
--

--- Patch [2]: [PATCH 02/10] drm/bridge: cdns-mhdp8546: Remove redundant dev_err() ---
commit bcaae5554e2b18efb874ecbcbc1b83f650920be8
Author: Pan Chuang <panchuang@vivo.com>

    drm/bridge: cdns-mhdp8546: Remove redundant dev_err()

This commit removes a redundant dev_err() call after devm_request_threaded_irq()
fails. The genirq subsystem already logs detailed error messages automatically,
making the driver-specific print unnecessary.

> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> index 504a3186ebb3a..f47717bd10798 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> @@ -2343,7 +2343,6 @@ static int cdns_mhdp_probe(struct platform_device *pdev)
>  					cdns_mhdp_irq_handler, IRQF_ONESHOT,
>  					"mhdp8546", mhdp);

[Severity: High]
This is a pre-existing issue, but waitqueues and workqueues accessed by the
interrupt handler are uninitialized at this point.

Because devm_request_threaded_irq() enables the interrupt immediately, an
active interrupt line from the bootloader could trigger cdns_mhdp_irq_handler()
before the driver initializes mhdp->sw_events_wq and mhdp->hpd_work.

Will the interrupt handler trigger a kernel panic due to iterating over
uninitialized waitqueue list heads if the interrupt fires early?

>  	if (ret) {
> -		dev_err(dev, "cannot install IRQ %d\n", irq);
>  		ret = -EIO;
>  		goto plat_fini;
>  	}

[Severity: High]
This is a pre-existing issue, but using devm_request_threaded_irq() without
explicitly disabling the irq creates a use-after-free window in
cdns_mhdp_remove().

Because the devm action frees the IRQ after cdns_mhdp_remove() returns, the
interrupt remains fully active during driver unbind:

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c:cdns_mhdp_remove() {
	...
	cancel_work_sync(&mhdp->modeset_retry_work);
	flush_work(&mhdp->hpd_work);
	/* Ignoring mhdp->hdcp.check_work and mhdp->hdcp.prop_work here. */
}

Could the active interrupt handler reschedule mhdp->hpd_work after flush_work()
completes, leading to a use-after-free when the devres cleanup subsequently
frees the mhdp structure?

[Severity: High]
This is a pre-existing issue, but is it safe to use a strict 100ms timeout in
cdns_mhdp_remove() while firmware is still loading?

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c:cdns_mhdp_remove() {
	...
	unsigned long timeout = msecs_to_jiffies(100);
	...
	ret = wait_event_timeout(mhdp->fw_load_wq,
				 mhdp->hw_state == MHDP_HW_READY,
				 timeout);
	...
}

If the asynchronous firmware request takes longer than 100ms (e.g. waiting for
a user-mode helper fallback which times out after 60s), remove() will proceed
and devres will free the mhdp structure.

When the firmware subsystem later invokes cdns_mhdp_fw_cb(), won't it
dereference the freed mhdp context pointer?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260723131649.134127-1-panchuang@vivo.com?part=2

  reply	other threads:[~2026-07-23 13:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 13:16 [PATCH 00/10] drm/bridge: Remove redundant error messages on IRQ request failure Pan Chuang
2026-07-23 13:16 ` [PATCH 01/10] drm/bridge: analogix_dp: Remove redundant dev_err() Pan Chuang
2026-07-24  1:14   ` Damon Ding
2026-07-23 13:16 ` [PATCH 02/10] drm/bridge: cdns-mhdp8546: " Pan Chuang
2026-07-23 13:29   ` sashiko-bot [this message]
2026-07-23 13:16 ` [PATCH 03/10] drm/bridge: lt9611: " Pan Chuang
2026-07-23 13:27   ` sashiko-bot
2026-07-23 13:16 ` [PATCH 04/10] drm/bridge: samsung-dsim: " Pan Chuang
2026-07-23 13:16 ` [PATCH 05/10] drm/bridge: synopsys: dw-dp: Remove redundant dev_err_probe() Pan Chuang
2026-07-23 13:16 ` [PATCH 06/10] drm/bridge: tc358767: Remove redundant dev_err() Pan Chuang
2026-07-23 13:16 ` [PATCH 07/10] drm/bridge: it6505: " Pan Chuang
2026-07-23 13:16 ` [PATCH 08/10] drm/bridge/sii8620: Remove redundant dev_err_probe() Pan Chuang
2026-07-23 13:16 ` [PATCH 09/10] drm/bridge: ti-sn65dsi83: " Pan Chuang
2026-07-23 13:26   ` sashiko-bot
2026-07-23 13:16 ` [PATCH 10/10] drm/bridge: ti-sn65dsi86: " Pan Chuang
2026-07-23 14:30 ` [PATCH 00/10] drm/bridge: Remove redundant error messages on IRQ request failure Luca Ceresoli

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=20260723132902.7389C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=panchuang@vivo.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.