[PATCH] scsi: wd719x: Fix potential firmware buffer leak on probe failure

From: Guangshuo Li

Date: Mon Nov 16 2026 - 09:28:49 EST


A failed chip initialization leaves the coherent firmware buffer behind
while probe releases the host. Disable the RISC and bus mastering before
unwinding the failed initialization, then free the firmware buffer along
with the other internal DMA buffers.

This issue was found by our static analysis tool under development.

Fixes: 48a310300663 ("wd719x: Introduce Western Digital WD7193/7197/7296 PCI SCSI card driver")
Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
---
drivers/scsi/wd719x.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 85cf6c9d2ec9..53c5a702ddd6 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -868,7 +868,14 @@ static int wd719x_board_found(struct Scsi_Host *sh)
return 0;

fail_free_irq:
+ wd719x_writeb(wd, WD719X_PCI_MODE_SELECT, 0);
+ pci_clear_master(wd->pdev);
free_irq(wd->pdev->irq, wd);
+ if (wd->fw_virt) {
+ dma_free_coherent(&wd->pdev->dev, wd->fw_size, wd->fw_virt,
+ wd->fw_phys);
+ wd->fw_virt = NULL;
+ }
fail_free_hash:
dma_free_coherent(&wd->pdev->dev, WD719X_HASH_TABLE_SIZE, wd->hash_virt,
wd->hash_phys);

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4