[PATCH] scsi: myrb: quiesce the SCSI host before controller teardown

Hongyan Xu <[email protected]> Thu, 6 Aug 2026 14:06:58 +0800
Newsgroups gmane.linux.kernel,gmane.linux.scsi,gmane.linux.kernel.stable
Message-ID <[email protected]>
myrb_remove() tears down the controller resources and drops the host
reference without first removing the SCSI host. The registered host can
therefore continue to dispatch queuecommand callbacks that use the
controller MMIO mappings and DMA pools after teardown. The monitor work is
also canceled only after the MMIO mappings have been released.

Remove the SCSI host before issuing the final controller command. Then stop
the monitor and destroy its pools before unmapping the hardware and
dropping the host reference.

Fixes: 081ff398c56c ("scsi: myrb: Add Mylex RAID controller (block interface)")
Cc: [email protected]
Signed-off-by: Hongyan Xu <[email protected]>
---
 drivers/scsi/myrb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index 3678b66310ed..adb2fadf9146 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -3496,9 +3496,10 @@ static void myrb_remove(struct pci_dev *pdev)
 	struct myrb_hba *cb = pci_get_drvdata(pdev);
 
 	shost_printk(KERN_NOTICE, cb->host, "Flushing Cache...");
+	scsi_remove_host(cb->host);
 	myrb_exec_type3(cb, MYRB_CMD_FLUSH, 0);
-	myrb_cleanup(cb);
 	myrb_destroy_mempools(cb);
+	myrb_cleanup(cb);
 }
 
 
-- 
2.50.1.windows.1