diff options
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_sbc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 7006c95586e3..38d7c33bbc99 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -1230,6 +1230,9 @@ sbc_dif_v1_verify(struct se_cmd *cmd, struct se_dif_v1_tuple *sdt, | |||
1230 | int block_size = dev->dev_attrib.block_size; | 1230 | int block_size = dev->dev_attrib.block_size; |
1231 | __be16 csum; | 1231 | __be16 csum; |
1232 | 1232 | ||
1233 | if (!(cmd->prot_checks & TARGET_DIF_CHECK_GUARD)) | ||
1234 | goto check_ref; | ||
1235 | |||
1233 | csum = cpu_to_be16(crc_t10dif(p, block_size)); | 1236 | csum = cpu_to_be16(crc_t10dif(p, block_size)); |
1234 | 1237 | ||
1235 | if (sdt->guard_tag != csum) { | 1238 | if (sdt->guard_tag != csum) { |
@@ -1239,6 +1242,10 @@ sbc_dif_v1_verify(struct se_cmd *cmd, struct se_dif_v1_tuple *sdt, | |||
1239 | return TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED; | 1242 | return TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED; |
1240 | } | 1243 | } |
1241 | 1244 | ||
1245 | check_ref: | ||
1246 | if (!(cmd->prot_checks & TARGET_DIF_CHECK_REFTAG)) | ||
1247 | return 0; | ||
1248 | |||
1242 | if (cmd->prot_type == TARGET_DIF_TYPE1_PROT && | 1249 | if (cmd->prot_type == TARGET_DIF_TYPE1_PROT && |
1243 | be32_to_cpu(sdt->ref_tag) != (sector & 0xffffffff)) { | 1250 | be32_to_cpu(sdt->ref_tag) != (sector & 0xffffffff)) { |
1244 | pr_err("DIFv1 Type 1 reference failed on sector: %llu tag: 0x%08x" | 1251 | pr_err("DIFv1 Type 1 reference failed on sector: %llu tag: 0x%08x" |