Fix for data corruption issue in the routine sd_prep_fn which can occur for 4kb sector support. The issue is that, the routine sd_prep_fn is sharing the same parameter called this_count for setting the LBA count and the underflow. When this routine converts this_count so the LBA count is in 4kb units, it is not converted back to 512 bytes units when setting the underflow. Thus underflow is off by a multiple of 8. This patch will set the underflow to the data transfer size in bytes. Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@xxxxxxx> Cc: stable@xxxxxxxxxx --- diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index fa3a591..3c4ad14 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -895,7 +895,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) * this many bytes between each connect / disconnect. */ SCpnt->transfersize = sdp->sector_size; - SCpnt->underflow = this_count << 9; + SCpnt->underflow = blk_rq_bytes(rq); SCpnt->allowed = SD_MAX_RETRIES; /* -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html