Commit cceca4a6 authored by Nicholas Bellinger's avatar Nicholas Bellinger

target/sbc: Return INVALID_CDB_FIELD if DIF + sess_prot_type disabled

In sbc_check_prot(), if PROTECT is non-zero for a backend device with
DIF disabled, and sess_prot_type is not set go ahead and return
INVALID_CDB_FIELD.
Reviewed-by: default avatarMartin Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent bffb5128
...@@ -702,9 +702,13 @@ sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb, ...@@ -702,9 +702,13 @@ sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb,
pi_prot_type = cmd->se_sess->sess_prot_type; pi_prot_type = cmd->se_sess->sess_prot_type;
break; break;
} }
if (!protect)
return TCM_NO_SENSE;
/* Fallthrough */ /* Fallthrough */
default: default:
return TCM_NO_SENSE; pr_err("Unable to determine pi_prot_type for CDB: 0x%02x "
"PROTECT: 0x%02x\n", cdb[0], protect);
return TCM_INVALID_CDB_FIELD;
} }
if (sbc_set_prot_op_checks(protect, fabric_prot, pi_prot_type, is_write, cmd)) if (sbc_set_prot_op_checks(protect, fabric_prot, pi_prot_type, is_write, cmd))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment