[PATCH] scsi: wd719x: avoid dereferencing list head in wd719x_interrupt()

From: TAKANO Mitsuhiro via B4 Relay

Date: Sat Nov 28 2026 - 18:05:47 EST


From: TAKANO Mitsuhiro <takano32@xxxxxxxxx>

In wd719x_interrupt(), if SCB_out does not match any entry in
wd->active_scbs, the list_for_each_entry() loop terminates with scb
pointing to the list head rather than a valid struct wd719x_scb. The
subsequent check 'if (SCB_out == scb->phys)' then dereferences an
invalid type-confused pointer.

Use !list_entry_is_head() to verify that a matching SCB was found before
calling wd719x_interrupt_SCB().

Fixes: 48a310300663 ("wd719x: Introduce Western Digital WD7193/7197/7296 PCI SCSI card driver")
Signed-off-by: TAKANO Mitsuhiro <takano32@xxxxxxxxx>
---
Verification: compile-tested on x86_64 with CONFIG_SCSI_WD719X=m
(make W=1 drivers/scsi/wd719x.o; 0 warnings) and checked with
scripts/checkpatch.pl --strict. Checked against linux-next (next-20261127)
and lore.kernel.org for duplicates. Not runtime-tested on WD719x hardware.

The change and the changelog text were produced with an AI coding
assistant (Gemini) working from the tree; I reviewed the diff and the
reasoning, and I am responsible for the submission.
---
drivers/scsi/wd719x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 85cf6c9d2..2f9a390d0 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -689,7 +689,7 @@ static irqreturn_t wd719x_interrupt(int irq, void *dev_id)
list_for_each_entry(scb, &wd->active_scbs, list)
if (SCB_out == scb->phys)
break;
- if (SCB_out == scb->phys)
+ if (!list_entry_is_head(scb, &wd->active_scbs, list))
wd719x_interrupt_SCB(wd, regs, scb);
else
dev_err(&wd->pdev->dev, "card returned invalid SCB pointer\n");

---
base-commit: f93eb7cfc4bfa5d46340f360873726e3e77f2365
change-id: 20261128-b4-scsi-wd719x-list-head-9b0add7a4563

Best regards,
--
TAKANO Mitsuhiro <takano32@xxxxxxxxx>