linux-stable/drivers/target
Roman Bolshakov 5676234f20 scsi: target/iblock: Fix overrun in WRITE SAME emulation
WRITE SAME corrupts data on the block device behind iblock if the command
is emulated. The emulation code issues (M - 1) * N times more bios than
requested, where M is the number of 512 blocks per real block size and N is
the NUMBER OF LOGICAL BLOCKS specified in WRITE SAME command. So, for a
device with 4k blocks, 7 * N more LBAs gets written after the requested
range.

The issue happens because the number of 512 byte sectors to be written is
decreased one by one while the real bios are typically from 1 to 8 512 byte
sectors per bio.

Fixes: c66ac9db8d ("[SCSI] target: Add LIO target core v4.0.0-rc6")
Cc: <stable@vger.kernel.org>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-07-02 16:35:52 -04:00
..
iscsi scsi: target/iscsi: Make sure PDU processing continues if parsing a command fails 2019-04-12 20:20:06 -04:00
loopback scsi: remove bidirectional command support 2019-02-05 21:29:21 -05:00
sbp scsi: target/core: Remove the write_pending_status() callback function 2019-02-04 21:23:59 -05:00
tcm_fc scsi: target/core: Remove the write_pending_status() callback function 2019-02-04 21:23:59 -05:00
Kconfig target: don't depend on SCSI 2018-08-02 15:19:49 -06:00
Makefile
target_core_alua.c scsi: target: alua: fix the tg_pt_gps_count 2019-03-27 20:33:07 -04:00
target_core_alua.h
target_core_configfs.c scsi: target/core: Rework the SPC-2 reservation handling code 2019-04-12 20:20:05 -04:00
target_core_device.c scsi: target/core: Fix a race condition in the LUN lookup code 2019-04-12 20:20:05 -04:00
target_core_fabric_configfs.c scsi: target: drop unnecessary get_fabric_name() accessor from fabric_ops 2018-11-28 18:50:58 -05:00
target_core_fabric_lib.c
target_core_file.c iov_iter: Separate type from direction and use accessor functions 2018-10-24 00:41:07 +01:00
target_core_file.h scsi: target: target/file: Add support of direct and async I/O 2018-05-14 22:40:08 -04:00
target_core_hba.c
target_core_iblock.c scsi: target/iblock: Fix overrun in WRITE SAME emulation 2019-07-02 16:35:52 -04:00
target_core_iblock.h scsi: target/core: Use the SECTOR_SHIFT constant 2018-10-16 01:13:35 -04:00
target_core_internal.h scsi: target/core: Make ABORT and LUN RESET handling synchronous 2018-12-07 21:22:55 -05:00
target_core_pr.c scsi: target/core: Rework the SPC-2 reservation handling code 2019-04-12 20:20:05 -04:00
target_core_pr.h scsi: target/core: Rework the SPC-2 reservation handling code 2019-04-12 20:20:05 -04:00
target_core_pscsi.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
target_core_pscsi.h
target_core_rd.c
target_core_rd.h
target_core_sbc.c scsi: target/core: Always call transport_complete_callback() upon failure 2018-10-16 01:13:35 -04:00
target_core_spc.c scsi: target: remove hardcoded T10 Vendor ID in INQUIRY response 2018-12-07 21:54:33 -05:00
target_core_stat.c scsi: target: consistently null-terminate t10_wwn strings 2018-12-07 21:54:33 -05:00
target_core_tmr.c scsi: target/core: Rework the SPC-2 reservation handling code 2019-04-12 20:20:05 -04:00
target_core_tpg.c scsi: target/core: Simplify transport_clear_lun_ref() 2018-12-07 21:20:07 -05:00
target_core_transport.c scsi: target/core: Add target_send_busy() 2019-02-04 21:28:48 -05:00
target_core_ua.c scsi: target: drop unnecessary get_fabric_name() accessor from fabric_ops 2018-11-28 18:50:58 -05:00
target_core_ua.h scsi: target: Fix handling of removed LUNs 2018-07-02 16:44:32 -04:00
target_core_user.c SCSI misc on 20190315 2019-03-16 12:51:50 -07:00
target_core_xcopy.c scsi: target/core: Make the XCOPY setup code easier to read by inlining two functions 2019-04-12 20:20:06 -04:00
target_core_xcopy.h