Commit e283c385 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

iscsi: fix AHS handling



Previously, we had a pdu->ahs pointer that was always NULL (never set
anywhere), and we would try to read data into this NULL pointer if the
initiator ever sent a PDU with a non-zero TotalAHSLength.

Rename the existing ahs_data array in the PDU to just "ahs" to minimize
the necessary changes.  We never actually dereference the ahs structure,
so its type is not important. (We can cast it later if we add support
for anything that requires an AHS.)

Change-Id: I10d19a6e0d99f326794cbe6469eacedadc634c67
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369315


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent a6014eb2
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -153,7 +153,6 @@ struct spdk_mobj {

struct spdk_iscsi_pdu {
	struct iscsi_bhs bhs;
	struct iscsi_ahs *ahs;
	struct spdk_mobj *mobj;
	uint8_t *data_buf;
	uint8_t *data;
@@ -178,7 +177,7 @@ struct spdk_iscsi_pdu {
	 * This should always be at the end of PDU data structure.
	 * we need to not zero this out when doing memory clear.
	 */
	uint8_t ahs_data[ISCSI_AHS_LEN];
	uint8_t ahs[ISCSI_AHS_LEN];

	struct {
		uint16_t length; /* iSCSI SenseLength (big-endian) */
+1 −1
Original line number Diff line number Diff line
@@ -531,7 +531,7 @@ struct spdk_iscsi_pdu *spdk_get_pdu(void)
	}

	/* we do not want to zero out the last part of the structure reserved for AHS and sense data */
	memset(pdu, 0, offsetof(struct spdk_iscsi_pdu, ahs_data));
	memset(pdu, 0, offsetof(struct spdk_iscsi_pdu, ahs));
	pdu->ref = 1;

	return pdu;
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ spdk_get_pdu(void)
		return NULL;
	}

	memset(pdu, 0, offsetof(struct spdk_iscsi_pdu, ahs_data));
	memset(pdu, 0, offsetof(struct spdk_iscsi_pdu, ahs));
	pdu->ref = 1;

	return pdu;