This is a note to let you know that I've just added the patch titled SCSI: use the scsi data buffer length to extract transfer size to the 3.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: scsi-use-the-scsi-data-buffer-length-to-extract-transfer-size.patch and it can be found in the queue-3.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 5616b0a46ed82eb9a093f752fc4d7bd3cc688583 Mon Sep 17 00:00:00 2001 From: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx> Date: Tue, 24 Jun 2014 16:59:35 +0200 Subject: SCSI: use the scsi data buffer length to extract transfer size From: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx> commit 5616b0a46ed82eb9a093f752fc4d7bd3cc688583 upstream. Commit 8846bab180fa introduced a helper that can be used to query the wire transfer size for a SCSI command taking protection information into account. However, some commands do not have a 1:1 mapping between the block range they work on and the payload size (discard, write same). After the scatterlist has been set up these requests use __data_len to store the number of bytes to report completion on. This means that callers of scsi_transfer_length() would get the wrong byte count for these types of requests. To overcome this we make scsi_transfer_length() use the scatterlist length in the scsi_data_buffer as basis for the wire transfer calculation instead of __data_len. Reported-by: Christoph Hellwig <hch@xxxxxxxxxxxxx> Debugged-by: Mike Christie <michaelc@xxxxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Signed-off-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Sagi Grimberg <sagig@xxxxxxxxxxxx> Fixes: d77e65350f2d82dfa0557707d505711f5a43c8fd Signed-off-by: James Bottomley <JBottomley@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- include/scsi/scsi_cmnd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -309,7 +309,7 @@ static inline void set_driver_byte(struc static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) { - unsigned int xfer_len = blk_rq_bytes(scmd->request); + unsigned int xfer_len = scsi_out(scmd)->length; unsigned int prot_op = scsi_get_prot_op(scmd); unsigned int sector_size = scmd->device->sector_size; Patches currently in stable-queue which might be from martin.petersen@xxxxxxxxxx are queue-3.15/scsi-use-the-scsi-data-buffer-length-to-extract-transfer-size.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html