Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fcp: Do not interpret check condition as underrun

This patch avoids that the FCoE initiator sends a REC message after
having received a SCSI response with non-zero status and non-zero
DATA IN buffer length.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>

authored by

Bart Van Assche and committed by
Robert Love
9de99010 7030fd62

+5 -5
+5 -5
drivers/scsi/libfc/fc_fcp.c
··· 902 902 /* 903 903 * Check for missing or extra data frames. 904 904 */ 905 - if (unlikely(fsp->xfer_len != expected_len)) { 905 + if (unlikely(fsp->cdb_status == SAM_STAT_GOOD && 906 + fsp->xfer_len != expected_len)) { 906 907 if (fsp->xfer_len < expected_len) { 907 908 /* 908 909 * Some data may be queued locally, ··· 956 955 * Test for transport underrun, independent of response 957 956 * underrun status. 958 957 */ 959 - if (fsp->xfer_len < fsp->data_len && !fsp->io_status && 958 + if (fsp->cdb_status == SAM_STAT_GOOD && 959 + fsp->xfer_len < fsp->data_len && !fsp->io_status && 960 960 (!(fsp->scsi_comp_flags & FCP_RESID_UNDER) || 961 - fsp->xfer_len < fsp->data_len - fsp->scsi_resid)) { 961 + fsp->xfer_len < fsp->data_len - fsp->scsi_resid)) 962 962 fsp->status_code = FC_DATA_UNDRUN; 963 - fsp->io_status = 0; 964 - } 965 963 } 966 964 967 965 seq = fsp->seq_ptr;