Re: [PATCH v2 1/3] scsi: libiscsi: reject a negative task index from parse_pdu_itt

From: Mike Christie

Date: Tue Oct 06 2026 - 20:09:49 EST


On 8/3/26 11:05 PM, Yehyeong Lee wrote:
> A transport that implements parse_pdu_itt hands libiscsi an index taken
> from the PDU, and both lookups bound it from above only:
>
> if (i >= session->cmds_max)
>
> i and cmds_max are both int, so a negative index passes and
> session->cmds[i] is read from before the array.
>
> be2iscsi produces one. beiscsi_parse_pdu() assigns the raw tag,
>
> *index = (int)itt;
>
> and beiscsi_complete_pdu() forwards an unsolicited NOP-In from the
> hardware async ring without replacing its ITT, so the value is the
> target's. It also reports the session's own age rather than the one in
> the tag, which leaves the age comparison in iscsi_verify_itt() with
> nothing to reject.
>
> Bound the index from below in both lookups.
>
> Fixes: bfead3b2cb46 ("[SCSI] be2iscsi: Adding msix and mcc_rings V3")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Yehyeong Lee <yhlee@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Mike Christie <michael.christie@xxxxxxxxxx>