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: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369315
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2017-07-12 17:50:19 -07:00 committed by Jim Harris
parent a6014eb2ad
commit e283c385e7
3 changed files with 3 additions and 4 deletions

View File

@ -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) */

View File

@ -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;

View File

@ -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;