From: kevin Barnett Date: Fri, 16 Sep 2016 20:01:51 +0000 (-0500) Subject: scsi: smartpqi: raid bypass lba calculation fix X-Git-Tag: v4.9-rc1~95^2~19 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=e018ef572ba4ff17caa9e82d5e1b5cea0d76f903;p=linux.git scsi: smartpqi: raid bypass lba calculation fix In the ioaccel path, the calculation of the starting LBA for READ(6)/WRITE(6) SCSI commands does not take into account the most significant 5 bits of the LBA: it only uses the least significant 16 bits of the starting LBA. Reported-by: Mahesh Rajashekhara Signed-off-by: Kevin Barnett Signed-off-by: Don Brace Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 52cfa268ca95..a535b2661f38 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -1954,7 +1954,8 @@ static int pqi_raid_bypass_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info, is_write = true; /* fall through */ case READ_6: - first_block = (u64)get_unaligned_be16(&scmd->cmnd[2]); + first_block = (u64)(((scmd->cmnd[1] & 0x1f) << 16) | + (scmd->cmnd[2] << 8) | scmd->cmnd[3]); block_cnt = (u32)scmd->cmnd[4]; if (block_cnt == 0) block_cnt = 256;