From: sashiko-bot@kernel.org
To: "Runyu Xiao" <runyu.xiao@seu.edu.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] fbdev: omapfb: panel-dsi-cm: initialize lock before registering display
Date: Tue, 18 Aug 2026 14:07:20 +0000 [thread overview]
Message-ID: <20260818140720.86DE41F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818135318.1957283-1-runyu.xiao@seu.edu.cn>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
Pre-existing issues:
- [High] List corruption and Use-After-Free due to missing display unregistration on probe error paths.
- [High] Premature device registration exposes the display to consumers before initialization is complete, risking uninitialized resource access.
- [High] Use-After-Free during driver removal due to non-synchronous cancellation of delayed work.
- [High] Race condition between TE interrupt handler and timeout work causing double bus unlock.
--
--- Patch [1]: [PATCH] fbdev: omapfb: panel-dsi-cm: initialize lock before registering display ---
commit 62bd817117921c28fba7141ddc3cf344ad0e4b1e
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
fbdev: omapfb: panel-dsi-cm: initialize lock before registering display
dsicm_probe() registers the display before initializing ddata->lock.
Once omapdss_register_display() publishes the display, another consumer
can reach a dsicm callback that takes this mutex while it is still
uninitialized.
Initialize the mutex before registering the display so the published
callbacks always see a valid lock.
> diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
> index 5e7963b4aa93c..8d1dcd4371139 100644
> --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
> +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
> @@ -1150,14 +1150,14 @@ static int dsicm_probe(struct platform_device *pdev)
> dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
> OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
>
> + mutex_init(&ddata->lock);
> +
> r = omapdss_register_display(dssdev);
> if (r) {
> dev_err(dev, "Failed to register panel\n");
> goto err_reg;
> }
[Severity: High]
This isn't a bug introduced by this patch, but does publishing the display
globally here expose it to consumers before initialization is complete?
If a consumer like omapfb discovers the display immediately and calls
dsicm_update() or dsicm_disable(), could they trigger cancel_delayed_work()
or schedule_delayed_work() on ulps_work and te_timeout_work before those
works are initialized later in the probe function?
>
> - mutex_init(&ddata->lock);
> -
> atomic_set(&ddata->do_update, 0);
>
> ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
[Severity: High]
This is a pre-existing issue, but does the error path for this and subsequent
initializations leak the registered display?
If devm_gpiod_get() fails:
if (r) {
dev_err(&pdev->dev, "Failed to request reset gpio: %d\n", r);
return r;
}
the probe function returns the error directly, but omapdss_register_display()
has already added dssdev->panel_list to the global panel_list. Since
omapdss_unregister_display() is never called on these error paths, will this
leave a dangling pointer in the global list that could cause a panic if
traversed?
[Severity: High]
This isn't a bug introduced by this patch, but does driver removal have a
use-after-free risk?
In dsicm_remove():
dsicm_cancel_ulps_work(ddata);
This uses cancel_delayed_work() for ulps_work, which does not wait for
currently executing work, and te_timeout_work cancellation appears to
be omitted entirely.
When remove() returns, devres frees the ddata structure. If either work item
is running or subsequently fires, will it dereference the freed ddata?
[Severity: High]
This is a pre-existing issue, but is there a race condition between the TE
interrupt handler and the timeout work?
In dsicm_te_timeout_work_callback():
atomic_set(&ddata->do_update, 0);
in->ops.dsi->bus_unlock(in);
If this executes concurrently with dsicm_te_isr(), could the ISR successfully
claim the update via atomic_cmpxchg() before the timeout work zeroes it?
If both paths then handle the frame, would this lead to an immediate
uncoordinated bus_unlock() from the timeout work and a subsequent
bus_unlock() from the frame-done callback?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260818135318.1957283-1-runyu.xiao@seu.edu.cn?part=1
next prev parent reply other threads:[~2026-08-18 14:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 13:53 [PATCH] fbdev: omapfb: panel-dsi-cm: initialize lock before registering display Runyu Xiao
2026-08-18 14:07 ` sashiko-bot [this message]
2026-08-18 16:49 ` Helge Deller
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=20260818140720.86DE41F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=runyu.xiao@seu.edu.cn \
--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.