[PATCH v4 0/4] scsi: arcmsr: bound adapter-supplied completion indices and message lengths
From: Yehyeong Lee
Date: Fri Nov 13 2026 - 22:39:01 EST
arcmsr uses three values from the DMA area the adapter writes - a
completion slot number, a type B ring index and a message length - as
subscripts or copy lengths unchecked. Patches 1-3 clamp the length,
reject an unissued slot and wrap the index, each reproduced on KASAN.
Patch 4 is not about an adapter-supplied value. Type B is the only type
whose completion ring is consumed with no lock: D, E and F take
acb->doneq_lock on the interrupt and the polling side, and patch 4 makes
B match them. arcmsr_abort() masks the outbound interrupts but never
waits for a running handler, so a working adapter is enough.
Not addressed. flag_ccb is unchecked but is the CDB address the driver
posted echoed back, so only a fabricating adapter leaves the pool. The
data_len double fetch needs the firmware to change the field between the
two reads, which patch 1 bounds anyway. Type F polling not restoring
cmdSMID is also handled by the dedicated polling function in
https://lore.kernel.org/all/91fa9048-ae23-4813-a8fe-bd64d5b374d5@xxxxxxxxxxxx/
so I am not sending it; I will rebase whichever lands second.
v4:
- Add patch 4, serialising the type B completion ring with doneq_lock,
as raised in review of v2 3/3:
https://lore.kernel.org/all/sashiko-outbox-167892@xxxxxxxxxx/
- Patches 1-3 unchanged.
Best regards,
Yehyeong Lee
Yehyeong Lee (4):
scsi: arcmsr: bound the firmware-supplied message length
scsi: arcmsr: check the completion index the adapter reports
scsi: arcmsr: wrap the type B completion index before using it
scsi: arcmsr: serialise the type B completion ring
drivers/scsi/arcmsr/arcmsr_hba.c | 45 +++++++++++++++++++++++++++++---
1 file changed, 41 insertions(+), 4 deletions(-)
base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
--
2.43.0