[PATCH v3 0/4] scsi: hisi_sas: Some misc fixes

From: Xingui Yang

Date: Thu Oct 08 2026 - 23:33:02 EST


This series contains three independent fixes for the hisi_sas driver,
plus a libsas fix found during review.

Patch 1 fixes an out-of-bounds memcpy in sas_ssp_task_response(): a
device-provided sense_data_len >= 0x80000000 turns negative in the
min_t(int, ...) clamp and becomes a huge memcpy length.

Patch 2 fixes incorrect delay values introduced by a previous
magic-number cleanup commit. Three delay sites were changed to use
a single macro (value 100) which did not match their original values,
causing increased boot and shutdown time.

Patch 3 clears stale PHY error counts on phyup so that error detection
is not misled by intermediate errors generated during link
establishment.

Patch 4 fixes spinup failures of directly-attached SAS HDDs that power
up in the Active_Wait state and wait for a NOTIFY(ENABLE SPINUP)
primitive before becoming ready: parse the sense data in the slot
completion path and send the primitive from deferred work.

Changes from v2:
Addresses the Sashiko AI review of v2.
- Clear all five error counter registers.
- Use pm_runtime_get_if_active().

Changes from v1:
Addresses the Sashiko AI review of v1.
- Add Patch 1, found in review of the sense parsing of patch 4.
- Clear the counters under phy->lock.
- Take a runtime PM reference for the deferred work

The remaining review findings are pre-existing issues, left for
separate fixes in the future.

Xingui Yang (4):
scsi: libsas: Fix out-of-bounds memcpy in sas_ssp_task_response()
scsi: hisi_sas: Fix incorrect delay values from magic-number cleanup
scsi: hisi_sas: Clear PHY error counts on phyup
scsi: hisi_sas: Fix spinup failure for SAS SSP devices in Active_Wait
state

drivers/scsi/hisi_sas/hisi_sas.h | 3 ++
drivers/scsi/hisi_sas/hisi_sas_main.c | 43 ++++++++++++++++++++++
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 4 ++
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 4 ++
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 51 ++++++++++++++++++--------
drivers/scsi/libsas/sas_task.c | 2 +-
6 files changed, 90 insertions(+), 17 deletions(-)

--
2.43.0