]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Jul 2019 14:01:20 +0000 (16:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Jul 2019 14:01:20 +0000 (16:01 +0200)
added patches:
scsi-target-iblock-fix-overrun-in-write-same-emulation.patch

queue-5.1/scsi-target-iblock-fix-overrun-in-write-same-emulation.patch [new file with mode: 0644]
queue-5.1/series

diff --git a/queue-5.1/scsi-target-iblock-fix-overrun-in-write-same-emulation.patch b/queue-5.1/scsi-target-iblock-fix-overrun-in-write-same-emulation.patch
new file mode 100644 (file)
index 0000000..c0705a1
--- /dev/null
@@ -0,0 +1,42 @@
+From 5676234f20fef02f6ca9bd66c63a8860fce62645 Mon Sep 17 00:00:00 2001
+From: Roman Bolshakov <r.bolshakov@yadro.com>
+Date: Tue, 2 Jul 2019 22:16:38 +0300
+Subject: scsi: target/iblock: Fix overrun in WRITE SAME emulation
+
+From: Roman Bolshakov <r.bolshakov@yadro.com>
+
+commit 5676234f20fef02f6ca9bd66c63a8860fce62645 upstream.
+
+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: c66ac9db8d4a ("[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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/target/target_core_iblock.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/target/target_core_iblock.c
++++ b/drivers/target/target_core_iblock.c
+@@ -515,7 +515,7 @@ iblock_execute_write_same(struct se_cmd
+               /* Always in 512 byte units for Linux/Block */
+               block_lba += sg->length >> SECTOR_SHIFT;
+-              sectors -= 1;
++              sectors -= sg->length >> SECTOR_SHIFT;
+       }
+       iblock_submit_bios(&list);
index 3ee5a7a6315fcb3fa4272bcceab5078636a4c515..8d32c0b831f76601bb90e0530d78795485113887 100644 (file)
@@ -93,3 +93,4 @@ dmaengine-qcom-bam_dma-fix-completed-descriptors-count.patch
 dmaengine-imx-sdma-remove-bd_intr-for-channel0.patch
 dmaengine-jz4780-fix-an-endian-bug-in-irq-handler.patch
 fs-validate_fs_parser-should-default-to-n.patch
+scsi-target-iblock-fix-overrun-in-write-same-emulation.patch