linux/drivers
Nicholas Bellinger a18a65bd69 target: Fix ->data_length re-assignment bug with SCSI overflow
commit 4c054ba63a upstream.

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>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-02 10:29:51 -07:00
..
accessibility
acpi ACPI: export symbol acpi_get_table_with_size 2012-09-14 10:00:19 -07:00
amba ARM: 7366/3: amba: Remove AMBA level regulator support 2012-04-13 14:04:08 +01:00
ata ata_piix: defer disks to the Hyper-V drivers by default 2012-06-17 11:21:29 -07:00
atm solos-pci: Fix DMA support 2012-06-10 00:36:08 +09:00
auxdisplay
base PM / Sleep: call early resume handlers when suspend_noirq fails 2012-08-09 08:31:30 -07:00
bcma bcma: add ext PA workaround for BCM4331 and BCM43431 2012-06-17 11:21:26 -07:00
block cciss: fix handling of protocol error 2012-10-02 10:29:50 -07:00
bluetooth Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth 2012-04-27 15:16:43 -04:00
cdrom
char random: mix in architectural randomness in extract_buf() 2012-08-15 08:10:30 -07:00
clk clk: Check parent for NULL in clk_change_rate 2012-07-19 08:58:59 -07:00
clocksource Revert "clocksource: Load the ACPI PM clocksource asynchronously" 2012-04-12 00:05:05 +02:00
connector
cpufreq cpufreq/powernow-k8: workqueue user shouldn't migrate the kworker to another CPU 2012-10-02 10:29:50 -07:00
cpuidle Merge branches 'idle-fix' and 'misc' into release 2012-04-06 21:48:59 -04:00
crypto crypto: mv_cesa requires on CRYPTO_HASH to build 2012-05-15 01:10:06 +00:00
dca
devfreq ARM: global cleanups 2012-03-27 16:03:32 -07:00
dio
dma Revert dma: imx-dma: Fix kernel crash due to missing clock conversion 2012-09-14 10:00:04 -07:00
edac edac: fix the error about memory type detection on SandyBridge 2012-06-22 11:37:15 -07:00
eisa
firewire Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
firmware dmi: Feed DMI table to /dev/random driver 2012-08-15 08:10:30 -07:00
gpio gpiolib: wm8994: Pay attention to the value set when enabling as output 2012-07-16 09:04:09 -07:00
gpu drm/vmwgfx: add MODULE_DEVICE_TABLE so vmwgfx loads at boot 2012-09-14 10:00:33 -07:00
hid HID: add NOGET quirk for Eaton Ellipse MAX UPS 2012-09-14 10:00:33 -07:00
hsi HSI: hsi_char: Remove max_data_size from sysfs 2012-04-23 14:23:32 +03:00
hv
hwmon hwmon: (asus_atk0110) Add quirk for Asus M5A78L 2012-09-14 10:00:34 -07:00
hwspinlock hwspinlock/core: use global ID to register hwspinlocks on multiple devices 2012-07-16 09:04:25 -07:00
i2c i2c-i801: Add Device IDs for Intel Lynx Point-LP PCH 2012-09-14 10:00:33 -07:00
ide Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
idle simple_open: automatically convert to simple_open() 2012-04-05 15:25:50 -07:00
ieee802154
infiniband IB/srp: Fix a race condition 2012-08-26 15:00:44 -07:00
input Input: i8042 - add Gigabyte T1005 series netbooks to noloop table 2012-09-14 10:00:33 -07:00
iommu iommu/amd: Fix hotplug with iommu=pt 2012-08-09 08:31:32 -07:00
isdn isdnloop: fix and simplify isdnloop_init() 2012-10-02 10:29:35 -07:00
leds drivers/leds: correct __devexit annotations 2012-05-10 15:06:44 -07:00
lguest
macintosh Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
mca
md md/raid1: don't abort a resync on the first badblock. 2012-08-15 08:10:08 -07:00
media USB: smsusb: remove __devinit* from the struct usb_device_id table 2012-09-14 10:00:21 -07:00
memstick
message Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
mfd ARM: pxa: remove irq_to_gpio from ezx-pcap driver 2012-08-15 08:10:32 -07:00
misc Merge branch 'akpm' (Andrew's patch-bomb) 2012-04-05 15:30:34 -07:00
mmc mmc: sdhci: fix incorrect command used in tuning 2012-08-09 08:31:27 -07:00
mtd mtd: nandsim: don't open code a do_div helper 2012-07-19 08:58:55 -07:00
net netconsole: remove a redundant netconsole_target_put() 2012-10-02 10:29:51 -07:00
nfc
nubus Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
of gpio: Fix range check in of_gpio_simple_xlate() 2012-04-10 14:20:56 -06:00
oprofile oprofile: perf: use NR_CPUS instead or nr_cpumask_bits for static array 2012-07-16 09:04:21 -07:00
parisc parisc: move definition of PAGE0 to asm/page.h 2012-05-10 15:12:08 -07:00
parport
pci PCI: EHCI: Fix crash during hibernation on ASUS computers 2012-09-14 10:00:20 -07:00
pcmcia Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia 2012-03-29 16:00:48 -07:00
pinctrl pinctrl: implement pinctrl_check_ops 2012-04-11 09:31:02 +02:00
platform asus-wmi: use ASUS_WMI_METHODID_DSTS2 as default DSTS ID. 2012-08-15 08:10:04 -07:00
pnp Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux 2012-03-30 16:45:39 -07:00
power Various small bugfixes and enhancements, plus two new drivers: 2012-03-30 16:09:02 -07:00
pps
ps3
ptp ptp_pch: Add missing #include <linux/slab.h> 2012-05-16 14:44:44 -04:00
rapidio rapidio/tsi721: fix unused variable compiler warning 2012-09-14 10:00:20 -07:00
regulator regulator: twl-regulator: fix up VINTANA1/VINTANA2 2012-09-14 10:00:21 -07:00
remoteproc remoteproc: fix missing CONFIG_FW_LOADER configurations 2012-07-16 09:04:25 -07:00
rpmsg rpmsg: fix dependency on initialization order 2012-07-19 08:58:57 -07:00
rtc rtc: wm831x: Feed the write counter into device_add_randomness() 2012-08-15 08:10:29 -07:00
s390 qeth: repair crash in qeth_l3_vlan_rx_kill_vid() 2012-08-09 08:31:38 -07:00
sbus Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
scsi SCSI: Fix 'Device not ready' issue on mpt2sas 2012-09-14 10:00:32 -07:00
sfi
sh SuperH updates for 3.4 merge window 2012-03-30 00:09:17 -07:00
sn
spi spi/pl022: disable port when unused 2012-08-09 08:31:38 -07:00
ssb
staging USB: winbond: remove __devinit* from the struct usb_device_id table 2012-09-14 10:00:06 -07:00
target target: Fix ->data_length re-assignment bug with SCSI overflow 2012-10-02 10:29:51 -07:00
tc
thermal
tty pmac_zilog,kdb: Fix console poll hook to return instead of loop 2012-08-26 15:00:43 -07:00
uio
usb USB: CDC ACM: Fix NULL pointer dereference 2012-09-14 10:00:22 -07:00
uwb uwb: fix error handling 2012-04-18 13:15:51 -07:00
vhost vhost-net: fix handle_rx buffer size 2012-05-11 18:16:57 -04:00
video video/smscufx: fix line counting in fb_write 2012-08-15 08:10:08 -07:00
virt
virtio virtio: balloon: let host know of updated balloon size before module removal 2012-05-17 12:14:34 +03:00
vlynq
w1
watchdog hpwdt: Only BYTE reads/writes to WD Timer port 0x72 2012-04-26 14:38:07 +02:00
xen xen/pciback: Fix proper FLR steps. 2012-09-14 10:00:33 -07:00
zorro
Kconfig Merge branch 'for-next' of git://gitorious.org/kernel-hsi/kernel-hsi 2012-04-02 09:50:40 -07:00
Makefile Merge branch 'for-next' of git://gitorious.org/kernel-hsi/kernel-hsi 2012-04-02 09:50:40 -07:00