]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
scsi: scsi_transport_fc: Widen FPIN pname walker counter to u32
authorMichael Bommarito <michael.bommarito@gmail.com>
Wed, 20 May 2026 13:30:15 +0000 (09:30 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 23 May 2026 01:54:47 +0000 (21:54 -0400)
commita9a39233ec1fc9f97ea1340a4d09bb7ec2be5153
tree1dda34cdd834c43bd37206b34dc37781707d7228
parente4bb73bf3ac11b4a93634660345b9d764a4a80df
scsi: scsi_transport_fc: Widen FPIN pname walker counter to u32

An adjacent Fibre Channel fabric actor that can deliver an FPIN ELS
frame to an lpfc or qla2xxx Linux initiator can trigger a non-return in
the generic FC transport. This is not a local userspace or IP network
path; the attacker must be able to inject fabric traffic, for example as
a compromised switch or fabric controller, or as a same-zone N_Port on a
fabric that permits source spoofing.

The Link-Integrity and Peer-Congestion FPIN walkers used a u8 loop
counter against the 32-bit on-wire pname_count field, and did not bound
pname_count by the descriptor body already validated by the TLV walker.
A pname_count of 256 therefore wraps the counter and keeps the loop
condition true indefinitely.

Factor the shared pname_list[] walk into one helper, widen the counter
to u32, and clamp pname_count against the entries that fit in the
descriptor body before iterating.

Fixes: 3dcfe0de5a97 ("scsi: fc: Parse FPIN packets and update statistics")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Link: https://patch.msgid.link/20260520133015.1018937-1-michael.bommarito@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_transport_fc.c