Skip to content

scsi: arcmsr: bound adapter-supplied completion indices and message lengths

Yehyeong Lee linux-scsi lkml stable 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 1 replyIn review
  2. v33 patches 3 repliesSuperseded
  3. v23 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches3 repliesSuperseded

Changes in v4 from the cover letter

- 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/[email protected]/
- Patches 1-3 unchanged.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4scsi: arcmsr: bound the firmware-supplied message lengthdrivers/scsi/arcmsr/arcmsr_hba.c+4 -00 replies
2/4scsi: arcmsr: check the completion index the adapter reportsdrivers/scsi/arcmsr/arcmsr_hba.c+24 -00 replies
3/4scsi: arcmsr: wrap the type B completion index before using itdrivers/scsi/arcmsr/arcmsr_hba.c+2 -21 reply
4/4scsi: arcmsr: serialise the type B completion ringdrivers/scsi/arcmsr/arcmsr_hba.c+11 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/4] scsi: arcmsr: bound adapter-supplied completion indices and message lengths

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/[email protected]/
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/[email protected]/
- 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

Signature · 1 line
2.43.0