SCSI: Pass the expected opcode to scsi_cdb_unmarshall()
Pass the opcode we expect to the unmarshalling function so it can do a basic check that we are trying to unmarshalling the right kind of cdb.
This commit is contained in:
@@ -96,7 +96,7 @@ void read10_cb(struct iscsi_context *iscsi _U_, int status, void *command_data,
|
|||||||
wt->rt = task;
|
wt->rt = task;
|
||||||
wt->client = client;
|
wt->client = client;
|
||||||
|
|
||||||
read10_cdb = scsi_cdb_unmarshall(task);
|
read10_cdb = scsi_cdb_unmarshall(task, SCSI_OPCODE_READ10);
|
||||||
if (read10_cdb == NULL) {
|
if (read10_cdb == NULL) {
|
||||||
printf("Failed to unmarshall READ10 CDB.\n");
|
printf("Failed to unmarshall READ10 CDB.\n");
|
||||||
exit(10);
|
exit(10);
|
||||||
|
|||||||
@@ -671,7 +671,7 @@ struct scsi_read10_cdb {
|
|||||||
|
|
||||||
EXTERN int scsi_datain_getfullsize(struct scsi_task *task);
|
EXTERN int scsi_datain_getfullsize(struct scsi_task *task);
|
||||||
EXTERN void *scsi_datain_unmarshall(struct scsi_task *task);
|
EXTERN void *scsi_datain_unmarshall(struct scsi_task *task);
|
||||||
EXTERN void *scsi_cdb_unmarshall(struct scsi_task *task);
|
EXTERN void *scsi_cdb_unmarshall(struct scsi_task *task, enum scsi_opcode opcode);
|
||||||
|
|
||||||
EXTERN struct scsi_task *scsi_cdb_read6(uint32_t lba, uint32_t xferlen, int blocksize);
|
EXTERN struct scsi_task *scsi_cdb_read6(uint32_t lba, uint32_t xferlen, int blocksize);
|
||||||
EXTERN struct scsi_task *scsi_cdb_read10(uint32_t lba, uint32_t xferlen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group_number);
|
EXTERN struct scsi_task *scsi_cdb_read10(uint32_t lba, uint32_t xferlen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group_number);
|
||||||
|
|||||||
@@ -2334,8 +2334,12 @@ scsi_read10_cdb_unmarshall(struct scsi_task *task)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
scsi_cdb_unmarshall(struct scsi_task *task)
|
scsi_cdb_unmarshall(struct scsi_task *task, enum scsi_opcode opcode)
|
||||||
{
|
{
|
||||||
|
if (task->cdb[0] != opcode) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
switch (task->cdb[0]) {
|
switch (task->cdb[0]) {
|
||||||
case SCSI_OPCODE_READ10:
|
case SCSI_OPCODE_READ10:
|
||||||
return scsi_read10_cdb_unmarshall(task);
|
return scsi_read10_cdb_unmarshall(task);
|
||||||
|
|||||||
Reference in New Issue
Block a user