aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_spc.c
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2013-01-29 16:33:05 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2013-01-29 17:22:01 -0500
commit49df9fc9b9fd41e5749c5a9be2d2076328f75fc7 (patch)
treee10c0fed21b6d37e6fbe536684f2af36ebec72fa /drivers/target/target_core_spc.c
parent64fe4f4f181cc2fe97d4176bf6ee6e3725ae33ec (diff)
target: Fix zero-length INQUIRY additional sense code regression
This patch fixes a minor regression introduced in v3.8-rc1 code where a zero-length INQUIRY was no longer returning the correct INVALID FIELD IN CDB additional sense code. This regression was introduced with the following commit: commit de103c93aff0bed0ae984274e5dc8b95899badab Author: Christoph Hellwig <hch@lst.de> Date: Tue Nov 6 12:24:09 2012 -0800 target: pass sense_reason as a return value and this patch has been tested with the following zero-length CDB: sg_raw /dev/sdd 12 00 83 00 00 00 SCSI Status: Check Condition Sense Information: Fixed format, current; Sense key: Illegal Request Additional sense: Invalid field in cdb Cc: Christoph Hellwig <hch@lst.de> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_spc.c')
-rw-r--r--drivers/target/target_core_spc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index 84f9e96e8ace..f8857d4eac66 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -641,11 +641,10 @@ spc_emulate_inquiry(struct se_cmd *cmd)
641 641
642out: 642out:
643 rbuf = transport_kmap_data_sg(cmd); 643 rbuf = transport_kmap_data_sg(cmd);
644 if (!rbuf) 644 if (rbuf) {
645 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 645 memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length));
646 646 transport_kunmap_data_sg(cmd);
647 memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); 647 }
648 transport_kunmap_data_sg(cmd);
649 648
650 if (!ret) 649 if (!ret)
651 target_complete_cmd(cmd, GOOD); 650 target_complete_cmd(cmd, GOOD);