Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2 3/3] scsi: mvumi: flush the event work before the host is freed
Date: Sun, 15 Nov 2026 12:33:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-215499@kernel.org> (raw)
In-Reply-To: <20261115122153.1446810-4-yhlee@isslab.korea.ac.kr>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] scsi: mvumi: mvumi_release_fw() called before
  pci_disable_device() on error
--

commit 4d0117b39b9433095d582919461757b3980ec9e3
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>

scsi: mvumi: flush the event work before the host is freed

This commit gives mvumi a dedicated workqueue for event notifications and
flushes or destroys it during probe failure and device removal before the
host is freed.

> diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
> index 48652640afc18..f58b29e55a377 100644
> --- a/drivers/scsi/mvumi.c
> +++ b/drivers/scsi/mvumi.c

[ ... ]

> @@ -2560,9 +2567,12 @@ static int mvumi_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
>  fail_io_attach:
>  	mhba->instancet->disable_intr(mhba);
>  	free_irq(mhba->pdev->irq, mhba);
> +	flush_workqueue(mhba->work_q);
>  fail_init_irq:
>  	mvumi_release_fw(mhba);
>  fail_init_fw:
> +	destroy_workqueue(mhba->work_q);
> +fail_alloc_workqueue:
>  	scsi_host_put(host);
>  
>  fail_alloc_instance:

[Severity: Medium]
Does fail_io_attach free quarantined DMA buffers in mvumi_release_fw()
while the controller still has bus-mastering enabled?

Because flush_workqueue(mhba->work_q) runs after free_irq(), any queued
mvumi_scan_events() work times out in mvumi_issue_blocked_cmd(), and
mvumi_delete_internal_cmd() quarantines cmd->data_buf and cmd->frame onto
mhba->res_list to be freed only after pci_disable_device().  However, unlike
mvumi_detach_one(), this error path calls mvumi_release_fw() ->
mvumi_release_mem_resource() before fail_set_dma_mask calls
pci_disable_device(pdev), so dma_free_coherent() returns those buffers and
mhba->handshake_page to the allocator while the controller can still DMA to
them.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261115122153.1446810-1-yhlee@isslab.korea.ac.kr?part=3

      reply	other threads:[~2026-11-15 12:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 12:21 [PATCH v2 0/3] scsi: mvumi: do not free or reuse buffers a timed-out command left with the device Yehyeong Lee
2026-11-15 12:21 ` [PATCH v2 1/3] scsi: mvumi: stop the controller bus-mastering before freeing its buffers Yehyeong Lee
2026-11-15 12:21 ` [PATCH v2 2/3] scsi: mvumi: quarantine a timed-out internal command's buffers Yehyeong Lee
2026-11-15 12:39   ` sashiko-bot
2026-11-15 12:21 ` [PATCH v2 3/3] scsi: mvumi: flush the event work before the host is freed Yehyeong Lee
2026-11-15 12:33   ` sashiko-bot [this message]

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=sashiko-outbox-215499@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yhlee@isslab.korea.ac.kr \
    /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