aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-04-14 14:55:01 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-04-16 01:47:15 -0400
commitcceca4a638708c7f62e60f9f99684a8d57358dd0 (patch)
tree71eb420754016068690cdbe53398025b7d74bd5e /drivers/target
parentbffb5128f91e820fd8804307a6431607c2c840a4 (diff)
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: Martin Petersen <martin.petersen@oracle.com> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_sbc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 0064ffe9a219..7006c95586e3 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -702,9 +702,13 @@ sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb,
702 pi_prot_type = cmd->se_sess->sess_prot_type; 702 pi_prot_type = cmd->se_sess->sess_prot_type;
703 break; 703 break;
704 } 704 }
705 if (!protect)
706 return TCM_NO_SENSE;
705 /* Fallthrough */ 707 /* Fallthrough */
706 default: 708 default:
707 return TCM_NO_SENSE; 709 pr_err("Unable to determine pi_prot_type for CDB: 0x%02x "
710 "PROTECT: 0x%02x\n", cdb[0], protect);
711 return TCM_INVALID_CDB_FIELD;
708 } 712 }
709 713
710 if (sbc_set_prot_op_checks(protect, fabric_prot, pi_prot_type, is_write, cmd)) 714 if (sbc_set_prot_op_checks(protect, fabric_prot, pi_prot_type, is_write, cmd))