summaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_transport.c
diff options
context:
space:
mode:
authorRoland Dreier2011-11-22 22:51:33 +0100
committerNicholas Bellinger2011-12-06 07:00:55 +0100
commit9b5cd7f37e1e018432111333e2a67f78ba41edfe (patch)
treec1d620a534f0fcb36c354bbe35daf53f3d30a743 /drivers/target/target_core_transport.c
parenttarget: Don't return an error status for 0-length READ and WRITE (diff)
downloadkernel-qcow2-linux-9b5cd7f37e1e018432111333e2a67f78ba41edfe.tar.gz
kernel-qcow2-linux-9b5cd7f37e1e018432111333e2a67f78ba41edfe.tar.xz
kernel-qcow2-linux-9b5cd7f37e1e018432111333e2a67f78ba41edfe.zip
target: Handle 0 correctly in transport_get_sectors_6()
SBC-3 says: A TRANSFER LENGTH field set to zero specifies that 256 logical blocks shall be written. Any other value specifies the number of logical blocks that shall be written. The old code was always just returning the value in the TRANSFER LENGTH byte. Fix this to return 256 if the byte is 0. Signed-off-by: Roland Dreier <roland@purestorage.com> Cc: stable@kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_transport.c')
-rw-r--r--drivers/target/target_core_transport.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 1b760a0b1109..9faaaae78b0a 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2144,10 +2144,15 @@ static inline u32 transport_get_sectors_6(
/*
* Everything else assume TYPE_DISK Sector CDB location.
- * Use 8-bit sector value.
+ * Use 8-bit sector value. SBC-3 says:
+ *
+ * A TRANSFER LENGTH field set to zero specifies that 256
+ * logical blocks shall be written. Any other value
+ * specifies the number of logical blocks that shall be
+ * written.
*/
type_disk:
- return (u32)cdb[4];
+ return cdb[4] ? : 256;
}
static inline u32 transport_get_sectors_10(