diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index fc95d308e..d19f90132 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -372,13 +372,6 @@ spdk_iscsi_pdu_calc_data_digest(struct spdk_iscsi_pdu *pdu) return crc32c; } -static bool -iscsi_check_data_segment_length(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *pdu, int data_len) -{ - return true; -} - static int iscsi_conn_read_data_segment(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, @@ -4698,6 +4691,9 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) return 0; } pdu->data_buf = pdu->mobj->buf; + pdu->data = pdu->mobj->buf; + pdu->data_from_mempool = true; + pdu->data_segment_len = data_len; if (spdk_unlikely(spdk_iscsi_get_dif_ctx(conn, pdu, &pdu->dif_ctx))) { pdu->dif_insert_or_strip = true; @@ -4739,29 +4735,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) spdk_trace_record(TRACE_ISCSI_READ_PDU, conn->id, pdu->data_valid_bytes, (uintptr_t)pdu, pdu->bhs.opcode); - /* Data Segment */ - if (data_len != 0) { - if (!iscsi_check_data_segment_length(conn, pdu, data_len)) { - rc = iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); - /* - * If spdk_iscsi_reject() was not able to reject the PDU, - * treat it as a fatal connection error. Otherwise, - * return SUCCESS here so that the caller will continue - * to attempt to read PDUs. - */ - if (rc == 0) { - spdk_put_pdu(pdu); - return 0; - } else { - goto error; - } - } - - pdu->data = pdu->data_buf; - pdu->data_from_mempool = true; - pdu->data_segment_len = data_len; - } - /* check digest */ if (conn->header_digest) { crc32c = spdk_iscsi_pdu_calc_header_digest(pdu);