Skip to content

scsi: lpfc: bound EDC descriptor TLV walk

Michael Bommarito linux-scsi lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2scsi: lpfc: bound EDC descriptor list by payload lengthdrivers/scsi/lpfc/lpfc_els.c+28 -130 replies
2/2scsi: lpfc: add KUnit coverage for EDC descriptor boundsdrivers/scsi/Kconfig drivers/scsi/lpfc/lpfc_els.c+161 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/2] scsi: lpfc: bound EDC descriptor TLV walk

An adjacent Fibre Channel fabric peer or device can crash an LPFC host with a malformed EDC ELS frame. lpfc_els_rcv_edc() trusts the EDC descriptor-list length from the received frame without checking that it fits in the actual ELS payload, so a short frame with an oversized descriptor-list length walks the TLV list past the receive buffer and trips a KASAN slab-out-of-bounds read in the ELS receive path.

Patch 1 passes the received payload length into lpfc_els_rcv_edc(), rejects truncated EDC headers and descriptor lists larger than the payload, and avoids logging a third payload word unless it is present. Patch 2 adds same-translation-unit KUnit/KASAN coverage: a benign EDC frame that must still parse and the malformed frame that must now be rejected.

Reproduced with the KUnit/KASAN test on f5459048c38a: stock trips

BUG: KASAN: slab-out-of-bounds in lpfc_els_rcv_edc after the benign

control passes; patched rejects the frame and both cases pass.

Michael Bommarito (2):
scsi: lpfc: bound EDC descriptor list by payload length
scsi: lpfc: add KUnit coverage for EDC descriptor bounds

 drivers/scsi/Kconfig         |   7 ++
 drivers/scsi/lpfc/lpfc_els.c | 195 ++++++++++++++++++++++++++++++++---
 2 files changed, 189 insertions(+), 13 deletions(-)

--
2.53.0