summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2012-02-13 16:18:14 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-02 10:31:56 -0700
commit65b45ddcdb7757d13daea218c49ff5dfb655079f (patch)
treeed989a561a4614b95be769ab58f15d0bd186c249 /include
parent9b5e6cedebb86c341ec5ee55f2ee317fba788844 (diff)
target: Fix up handling of short INQUIRY buffers
commit d95b82461c56a6ff8ff248b101049a69ebb20278 upstream. If the initiator sends us an INQUIRY command with an allocation length that's shorter than what we want to return, we're simply supposed to truncate our response and return what the initiator gave us space for, without signaling any error. Current target code has various tests that don't fill out the full response if the buffer is too short and sometimes return errors incorrectly. Fix this up by allocating a bounce buffer for INQUIRY responses if we need to, ie if we have cmd->data_length too small as well as SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC set in cmd->se_cmd_flags -- for most fabrics, we always allocate at least a full page, but for tcm_loop we may have a small buffer coming directly from the SCSI stack. This lets us delete a lot of cmd->data_length checking, and also makes our INQUIRY handling correct per SPC in a lot more cases. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/target/target_core_base.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index dc4e345a0163..fe73eb87a562 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -118,9 +118,9 @@
/* Queue Algorithm Modifier default for restricted reordering in control mode page */
#define DA_EMULATE_REST_REORD 0
+#define SE_INQUIRY_BUF 512
#define SE_MODE_PAGE_BUF 512
-
/* struct se_hba->hba_flags */
enum hba_flags_table {
HBA_FLAGS_INTERNAL_USE = 0x01,