Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] ufs: host: Remove redundant dev_err()
Date: Fri, 17 Jul 2026 04:03:05 +0000	[thread overview]
Message-ID: <20260717040305.C3B091F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260717035013.563791-1-panchuang@vivo.com>

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

Pre-existing issues:
- [High] Teardown order violation in ufs_qcom_remove() destroys the MSI domain before devres-managed IRQs are freed, leading to a potential Use-After-Free or panic.
--

--- Patch [1]: [PATCH] ufs: host: Remove redundant dev_err() ---
commit 2d60d33ee1768b4175522f72c450271bc5ddc6ae
Author: Pan Chuang <panchuang@vivo.com>

ufs: host: Remove redundant dev_err()

Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() calls.

> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 291c434487648..7d690ea2fa674 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -2431,8 +2431,6 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba)
>  		ret = devm_request_irq(hba->dev, qi[idx].irq, ufs_qcom_mcq_esi_handler,
>  				       IRQF_SHARED, "qcom-mcq-esi", qi + idx);
>  		if (ret) {
> -			dev_err(hba->dev, "%s: Failed to request IRQ for %d, err = %d\n",
> -				__func__, qi[idx].irq, ret);
>  			/* Free previously allocated IRQs */
>  			for (int j = 0; j < idx; j++)
>  				devm_free_irq(hba->dev, qi[j].irq, qi + j);

[Severity: High]
This is a pre-existing issue, but since devres-managed IRQs are used here, 
does ufs_qcom_remove() break teardown symmetry?

In ufs_qcom_remove(), the MSI domain is destroyed manually before
devres-managed IRQ handlers are released:

drivers/ufs/host/ufs-qcom.c:ufs_qcom_remove() {
    ...
    ufshcd_pltfrm_remove(pdev);
    if (host->esi_enabled)
        platform_device_msi_free_irqs_all(hba->dev);
    ...
}

When the device is unbound, platform_device_msi_free_irqs_all() destroys the
MSI IRQ domain and descriptors before devres runs.

When devm_irq_release() later calls free_irq(), it silently returns early
because the descriptor is already gone. This bypasses the critical
__synchronize_irq() and kthread_stop() cleanup logic.

Could this permanently leak the threaded IRQ handlers (struct irqaction
objects) and cause a use-after-free or kernel panic if a handler is
scheduled or running while the driver memory is freed?

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

  reply	other threads:[~2026-07-17  4:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  3:50 [PATCH] ufs: host: Remove redundant dev_err() Pan Chuang
2026-07-17  4:03 ` sashiko-bot [this message]
2026-07-17  6:35 ` Peter Wang (王信友)

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=20260717040305.C3B091F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-scsi@vger.kernel.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