iscsi-test: check for invalid descriptors offsets in get_lba_status
Dell Equallogic sans report an invalid LBA offset in the descriptor when using 4k LUNs. Check the descriptor for consistency with the request. Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
@@ -1894,6 +1894,8 @@ struct scsi_task *get_lba_status_task(struct iscsi_context *iscsi, int lun, uint
|
||||
int get_lba_status(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t len)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
struct scsi_get_lba_status *lbas = NULL;
|
||||
struct scsi_lba_status_descriptor *lbasd = NULL;
|
||||
|
||||
logging(LOG_VERBOSE, "Send GET_LBA_STATUS LBA:%" PRIu64 " alloc_len:%d",
|
||||
lba, len);
|
||||
@@ -1919,6 +1921,21 @@ int get_lba_status(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
lbas = scsi_datain_unmarshall(task);
|
||||
if (lbas == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] GET_LBA_STATUS command: "
|
||||
"failed to unmarschall data.");
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
lbasd = &lbas->descriptors[0];
|
||||
if (lbasd->lba != lba) {
|
||||
logging(LOG_NORMAL, "[FAILED] GET_LBA_STATUS command: "
|
||||
"lba offset in first descriptor does not match request (0x%" PRIx64 " != 0x%" PRIx64 ").",
|
||||
lbasd->lba, lba);
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] GET_LBA_STATUS returned SUCCESS.");
|
||||
|
||||
Reference in New Issue
Block a user