iscsi-target: Do not generate REJECTs for zero-length DataOUT

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Nov 22 17:59:08 EST 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=dbcbc95cd85854588ac80c0a6d98586fa2129418
Commit:     dbcbc95cd85854588ac80c0a6d98586fa2129418
Parent:     95b60f078899a9680688bab909d02169e1fd632e
Author:     Nicholas Bellinger <nab at linux-iscsi.org>
AuthorDate: Wed Nov 6 20:55:39 2013 -0800
Committer:  Nicholas Bellinger <nab at linux-iscsi.org>
CommitDate: Thu Nov 7 12:08:56 2013 -0800

    iscsi-target: Do not generate REJECTs for zero-length DataOUT
    
    This patch changes iscsit_check_dataout_hdr() to no longer generate
    REJECTs for zero-length DataOUTs, and instead simply ignore these
    requests.
    
    This follows RFC-3720, Section 10.7.7.  DataSegmentLength
    
      "This is the data payload length of a SCSI Data-In or SCSI Data-Out PDU.
       The sending of 0 length data segments should be avoided, but initiators
       and targets MUST be able to properly receive 0 length data segments."
    
    Reported-by: Santosh Kulkarni <santosh.kulkarni at calsoftinc.com>
    Signed-off-by: Nicholas Bellinger <nab at linux-iscsi.org>
---
 drivers/target/iscsi/iscsi_target.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index e183352..ab64cbb 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1249,9 +1249,8 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf,
 	int rc;
 
 	if (!payload_length) {
-		pr_err("DataOUT payload is ZERO, protocol error.\n");
-		return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR,
-					 buf);
+		pr_warn("DataOUT payload is ZERO, ignoring.\n");
+		return 0;
 	}
 
 	/* iSCSI write */
@@ -1481,7 +1480,7 @@ EXPORT_SYMBOL(iscsit_check_dataout_payload);
 
 static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf)
 {
-	struct iscsi_cmd *cmd;
+	struct iscsi_cmd *cmd = NULL;
 	struct iscsi_data *hdr = (struct iscsi_data *)buf;
 	int rc;
 	bool data_crc_failed = false;



More information about the linux-mtd-cvs mailing list