dri-devel Archive on 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 3/7] fbdev: pxa168fb: Remove redundant dev_err()
Date: Wed, 22 Jul 2026 08:06:55 +0000	[thread overview]
Message-ID: <20260722080656.2F4311F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260722075803.570532-4-panchuang@vivo.com>

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

Pre-existing issues:
- [High] The driver unconditionally returns `-ENOENT` when `platform_get_irq()` fails, breaking probe deferral.
- [High] The error path and remove function trigger a use-after-free and unclocked register access due to improper devm_request_irq() lifecycle.
- [High] Missing return value check for clk_prepare_enable() leads to possible system hang.
--

--- Patch [3]: [PATCH 3/7] fbdev: pxa168fb: Remove redundant dev_err() ---
commit 8117b479bf3e32b7a9c22b5f0311cebdedb684e8
Author: Pan Chuang <panchuang@vivo.com>

fbdev: pxa168fb: Remove redundant dev_err()

Since devm_request_irq() automatically logs detailed error messages on
failure, this commit removes the now-redundant driver-specific dev_err()
call in pxa168fb_probe().

> diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c
> index 6784888d93c9f..ce8a823d7128e 100644
> --- a/drivers/video/fbdev/pxa168fb.c
> +++ b/drivers/video/fbdev/pxa168fb.c
> @@ -725,7 +725,6 @@ static int pxa168fb_probe(struct platform_device *pdev)

[Severity: High]
This is a pre-existing issue, but does this function mishandle probe
deferral?

Looking at the earlier part of pxa168fb_probe():

pxa168fb_probe()
    ...
    irq = platform_get_irq(pdev, 0);
    if (irq < 0)
        return -ENOENT;

If platform_get_irq() returns -EPROBE_DEFER, this overwrites it to -ENOENT,
which will prevent the kernel from retrying the probe later. Could this
return the actual error code instead?

[Severity: High]
This is a pre-existing issue, but is there a missing check for the return
value of clk_prepare_enable()?

Just before the IRQ request in pxa168fb_probe():

pxa168fb_probe()
    ...
    /*
     * enable controller clock
     */
    clk_prepare_enable(fbi->clk);

    pxa168fb_set_par(info);

If clk_prepare_enable() fails, the clock remains disabled. The driver then
calls pxa168fb_set_par() which writes to memory-mapped registers. Could
accessing these registers without an active clock cause a synchronous
external bus abort?

>  	ret = devm_request_irq(&pdev->dev, irq, pxa168fb_handle_irq,
>  			       IRQF_SHARED, info->fix.id, fbi);
>  	if (ret < 0) {
> -		dev_err(&pdev->dev, "unable to request IRQ\n");
>  		ret = -ENXIO;
>  		goto failed_free_cmap;
>  	}

[Severity: High]
This is a pre-existing issue, but does using a devm-managed IRQ here
introduce a use-after-free or unclocked register access during cleanup?

Because devm_request_irq() is used with IRQF_SHARED, the IRQ handler remains
registered until the devres cleanup runs, which happens after
pxa168fb_probe() or pxa168fb_remove() returns.

However, the error path and remove function free the resources early:

failed_free_clk:
    clk_disable_unprepare(fbi->clk);
failed_free_fbmem:
    ...
failed_free_info:
    framebuffer_release(info);

If another shared device triggers an interrupt during this window,
pxa168fb_handle_irq() will dereference the freed fbi pointer and read
hardware registers without an active clock:

pxa168fb_handle_irq()
    struct pxa168fb_info *fbi = dev_id;
    u32 isr = readl(fbi->reg_base + SPU_IRQ_ISR);

Should the driver explicitly free the IRQ or use a non-devm request to avoid
this race?

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

  reply	other threads:[~2026-07-22  8:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  7:57 [PATCH 0/7] video: fbdev: Remove redundant dev_err() Pan Chuang
2026-07-22  7:57 ` [PATCH 1/7] fbdev: mmp: " Pan Chuang
2026-07-22  8:07   ` sashiko-bot
2026-07-22  7:57 ` [PATCH 2/7] fbdev: omapfb/dsi-cm: " Pan Chuang
2026-07-22  8:08   ` sashiko-bot
2026-07-22  7:57 ` [PATCH 3/7] fbdev: pxa168fb: " Pan Chuang
2026-07-22  8:06   ` sashiko-bot [this message]
2026-07-22  7:57 ` [PATCH 4/7] fbdev: pxa3xx-gcu: " Pan Chuang
2026-07-22  8:07   ` sashiko-bot
2026-07-22  7:57 ` [PATCH 5/7] fbdev: pxafb: " Pan Chuang
2026-07-22  8:14   ` sashiko-bot
2026-07-22  7:57 ` [PATCH 6/7] fbdev: s3c-fb: " Pan Chuang
2026-07-22  8:20   ` sashiko-bot
2026-07-22  7:57 ` [PATCH 7/7] fbdev: sa1100fb: " Pan Chuang
2026-07-22  8:15   ` sashiko-bot

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=20260722080656.2F4311F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox