summaryrefslogtreecommitdiff
path: root/include/target
diff options
context:
space:
mode:
authorAleksandr Miloserdov <a.miloserdov@yadro.com>2021-02-09 10:22:01 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-17 17:03:45 +0100
commitde2cdbcb4f38df2976b0023e08f59b1a9aa21ab6 (patch)
tree8f548d0ef519de59967e7bd102e186cc96880013 /include/target
parent050e1900d6176ff7f23263151136cf1e68010a80 (diff)
scsi: target: core: Add cmd length set before cmd complete
[ Upstream commit 1c73e0c5e54d5f7d77f422a10b03ebe61eaed5ad ] TCM doesn't properly handle underflow case for service actions. One way to prevent it is to always complete command with target_complete_cmd_with_length(), however it requires access to data_sg, which is not always available. This change introduces target_set_cmd_data_length() function which allows to set command data length before completing it. Link: https://lore.kernel.org/r/20210209072202.41154-2-a.miloserdov@yadro.com Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Bodo Stroesser <bostroesser@gmail.com> Signed-off-by: Aleksandr Miloserdov <a.miloserdov@yadro.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/target')
-rw-r--r--include/target/target_core_backend.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 51b6f50eabee..0deeff9b4496 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -69,6 +69,7 @@ int transport_backend_register(const struct target_backend_ops *);
void target_backend_unregister(const struct target_backend_ops *);
void target_complete_cmd(struct se_cmd *, u8);
+void target_set_cmd_data_length(struct se_cmd *, int);
void target_complete_cmd_with_length(struct se_cmd *, u8, int);
void transport_copy_sense_to_cmd(struct se_cmd *, unsigned char *);