linux/drivers/target
Nicholas Bellinger 4c054ba63a target: Fix ->data_length re-assignment bug with SCSI overflow
This patch fixes a long-standing bug with SCSI overflow handling
where se_cmd->data_length was incorrectly being re-assigned to
the larger CDB extracted allocation length, resulting in a number
of fabric level errors that would end up causing a session reset
in most cases.  So instead now:

 - Only re-assign se_cmd->data_length durining UNDERFLOW (to use the
   smaller value)
 - Use existing se_cmd->data_length for OVERFLOW (to use the smaller
   value)

This fix has been tested with the following CDB to generate an
SCSI overflow:

  sg_raw -r512 /dev/sdc 28 0 0 0 0 0 0 0 9 0

Tested using iscsi-target, tcm_qla2xxx, loopback and tcm_vhost fabric
ports.  Here is a bit more detail on each case:

 - iscsi-target: Bug with open-iscsi with overflow, sg_raw returns
                 -3584 bytes of data.
 - tcm_qla2xxx: Working as expected, returnins 512 bytes of data
 - loopback: sg_raw returns CHECK_CONDITION, from overflow rejection
             in transport_generic_map_mem_to_cmd()
 - tcm_vhost: Same as loopback

Reported-by: Roland Dreier <roland@purestorage.com>
Cc: Roland Dreier <roland@purestorage.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-08-23 15:26:52 -07:00
..
iscsi iscsi-target: Drop bogus struct file usage for iSCSI/SCTP 2012-07-21 02:44:13 -07:00
loopback target: remove transport_generic_process_write 2012-07-16 17:35:16 -07:00
sbp target: Allow for target_submit_cmd() returning errors 2012-07-17 17:05:05 -07:00
tcm_fc tcm_fc: rcu_deref outside rcu lock/unlock section 2012-08-20 14:52:15 -07:00
Kconfig sbp-target: Initial merge of firewire/ieee-1394 target mode support 2012-05-09 15:25:17 -07:00
Makefile target: move code for CDB emulation 2012-07-16 17:27:45 -07:00
target_core_alua.c target: Return error to initiator if SET TARGET PORT GROUPS emulation fails 2012-06-12 20:12:25 -07:00
target_core_alua.h target: Add MI_REPORT_TARGET_PGS ext. header + implict_trans_secs attribute 2012-05-17 00:45:58 -07:00
target_core_configfs.c Revert "target: Do not special-case loop and iscsi fabric module loads" 2012-07-16 17:35:14 -07:00
target_core_device.c target: Make unnecessarily global se_dev_align_max_sectors() static 2012-07-16 17:35:35 -07:00
target_core_fabric_configfs.c target: Remove hba param from core_dev_add_lun 2012-07-16 17:35:22 -07:00
target_core_fabric_lib.c target: remove useless casts 2011-12-14 11:28:07 +00:00
target_core_file.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2012-08-01 10:26:23 -07:00
target_core_file.h target/file: Use O_DSYNC by default for FILEIO backends 2012-06-02 23:47:20 -07:00
target_core_hba.c target: header reshuffle, part2 2011-12-14 11:26:05 +00:00
target_core_iblock.c target: Check number of unmap descriptors against our limit 2012-07-16 17:35:36 -07:00
target_core_iblock.h target/iblock: Add parameter to specify read-only devices 2012-07-16 17:29:11 -07:00
target_core_internal.h target: refactor core_update_device_list_for_node() 2012-07-16 17:35:24 -07:00
target_core_pr.c target: Remove unneeded double parentheses 2012-07-16 17:35:22 -07:00
target_core_pr.h target: replace ->execute_task with ->execute_cmd 2012-05-06 15:11:14 -07:00
target_core_pscsi.c target/pscsi: Fix bug with REPORT_LUNs handling for SCSI passthrough 2012-08-16 23:36:55 -07:00
target_core_pscsi.h target: remove struct se_task 2012-05-06 15:11:26 -07:00
target_core_rd.c target: add struct spc_ops + initial ->execute_rw pointer usage 2012-07-16 17:29:12 -07:00
target_core_rd.h target: don't limit transfer sizes for the ramdisk backend 2012-04-14 17:40:30 -07:00
target_core_sbc.c target: move unmap to struct spc_ops 2012-07-16 17:35:14 -07:00
target_core_spc.c target: Move MAINTENANCE_[IN,OUT] from pscsi_parse_cdb -> spc_parse_cdb 2012-07-16 17:28:40 -07:00
target_core_stat.c target: remove obvious warnings 2012-03-15 19:16:09 -07:00
target_core_tmr.c target: replace the processing thread with a TMR work queue 2012-07-16 17:35:21 -07:00
target_core_tpg.c target: refactor core_update_device_list_for_node() 2012-07-16 17:35:24 -07:00
target_core_transport.c target: Fix ->data_length re-assignment bug with SCSI overflow 2012-08-23 15:26:52 -07:00
target_core_ua.c target: Use array_zalloc for device_list 2012-03-15 19:15:51 -07:00
target_core_ua.h [SCSI] target: Add LIO target core v4.0.0-rc6 2011-01-14 10:12:29 -06:00