Skip to content

scsi: ufs: Fix descriptor parsing and invalid input handling

Li Qiang linux-scsi lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 14 repliesIn review
  2. v15 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- Reworked patch 2 as requested: drop changes to the safe scsi_cmd_priv(NULL) and scsi_cmd_to_rq(NULL) calls and retain only the invalid-CQE diagnostic fix.
- Split the previous RPMB patch into a request-length validation patch and an independent unaligned-access patch.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6scsi: ufs: core: Validate string descriptorsdrivers/ufs/core/ufshcd.c+19 -52 replies
2/6scsi: ufs: Avoid NULL CQE dereference when reporting invalid tagsdrivers/ufs/core/ufshcd.c+2 -22 replies
3/6scsi: ufs: core: Validate connected lane countsdrivers/ufs/core/ufshcd.c+3 -10 replies
4/6scsi: ufs: rpmb: Validate request frame length before parsingdrivers/ufs/core/ufs-rpmb.c+4 -02 replies
5/6scsi: ufs: rpmb: Use unaligned accessors for RPMB framesdrivers/ufs/core/ufs-rpmb.c+2 -24 replies
6/6scsi: ufs: debugfs: Reserve space for a string terminatordrivers/ufs/core/ufs-debugfs.c+1 -12 replies

Reviews trailers per patch

5 of 6 patches have a Reviewed-by or Acked-by.

PatchPeter WangBean HuoBart Van Assche
1/6R-b R-b
2/6R-b R-b
3/6
4/6R-b R-b
5/6R-b
6/6R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/6] scsi: ufs: Fix descriptor parsing and invalid input handling

The first patch validates string descriptor payload sizes and avoids raw descriptor overreads. The remaining patches protect invalid completion diagnostics, validate connected lane counts, validate RPMB frame sizes, use unaligned RPMB frame accesses, and retain a NUL terminator for debugfs input.

Changes in v2:
- Reworked patch 2 as requested: drop changes to the safe scsi_cmd_priv(NULL) and scsi_cmd_to_rq(NULL) calls and retain only the invalid-CQE diagnostic fix.
- Split the previous RPMB patch into a request-length validation patch and an independent unaligned-access patch.

Li Qiang (6):
scsi: ufs: core: Validate string descriptors
scsi: ufs: Avoid NULL CQE dereference when reporting invalid tags
scsi: ufs: core: Validate connected lane counts
scsi: ufs: rpmb: Validate request frame length before parsing
scsi: ufs: rpmb: Use unaligned accessors for RPMB frames
scsi: ufs: debugfs: Reserve space for a string terminator

 drivers/ufs/core/ufs-debugfs.c |  2 +-
 drivers/ufs/core/ufs-rpmb.c    |  8 ++++++--
 drivers/ufs/core/ufshcd.c      | 32 ++++++++++++++++++++++++--------
 3 files changed, 31 insertions(+), 11 deletions(-)
Signature · 1 line
2.43.0