lkml.org 
[lkml]   [2017]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] iscsi-target: Reject immediate data underflow larger than SCSI transfer length
Date
On Thu, 2017-06-08 at 04:21 +0000, Nicholas A. Bellinger wrote:
> + /*
> + * Check for underflow case where both EDTL and immediate data payload
> + * exceeds what is presented by CDB's TRANSFER LENGTH, and what has
> + * already been set in target_cmd_size_check() as se_cmd->data_length.
> + *
> + * For this special case, fail the command and dump the immediate data
> + * payload.
> + */
> + if (cmd->first_burst_len > cmd->se_cmd.data_length) {
> + cmd->sense_reason = TCM_INVALID_CDB_FIELD;
> + goto after_immediate_data;
> + }

A quote from the iSCSI RFC (https://tools.ietf.org/html/rfc5048):

If SPDTL < EDTL for a task, iSCSI Underflow MUST be signaled in the
   SCSI Response PDU as specified in [RFC3720].  The Residual Count MUST
   be set to the numerical value of (EDTL - SPDTL).

Sorry but I don't think that sending TCM_INVALID_CDB_FIELD back to the
initiator is compliant with the iSCSI RFC. Please note that a fix that is
compliant with the iSCSI RFC is present in the following patch series: [PATCH
00/33] SCSI target driver patches for kernel v4.13, 23 May 2017
(https://www.spinics.net/lists/target-devel/msg15370.html).

Bart.
\
 
 \ /
  Last update: 2017-06-12 01:32    [W:0.106 / U:30.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site