diff options
author | Eric Moore <eric.moore@lsi.com> | 2009-04-22 01:38:43 +0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-27 19:53:56 +0400 |
commit | 0d04df9b4a83c50ebe2143f20c2d5469c83ba314 (patch) | |
tree | 80ebe645b66fcad6ec87ebe6baff037836dc81ad /drivers/scsi | |
parent | 03ea1115506c53b46cec2177deb189d186bb80dd (diff) | |
download | linux-0d04df9b4a83c50ebe2143f20c2d5469c83ba314.tar.xz |
[SCSI] mpt2sas : fix oops when firmware sends large sense buffer size
There is a bug in firmware where the reply message frame says there is a
16kb sense buffer, when in reality its only 20 bytes. This fix insures
the memcpy action doesn't corrupte the memory beyond the 90 bytes allocated in
the scsi command for sense buffer.
Signed-off-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_scsih.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 0c463c483c02..f2d967c5415e 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -2863,8 +2863,9 @@ scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply) struct sense_info data; const void *sense_data = mpt2sas_base_get_sense_buffer(ioc, smid); - memcpy(scmd->sense_buffer, sense_data, + u32 sz = min_t(u32, SCSI_SENSE_BUFFERSIZE, le32_to_cpu(mpi_reply->SenseCount)); + memcpy(scmd->sense_buffer, sense_data, sz); _scsih_normalize_sense(scmd->sense_buffer, &data); /* failure prediction threshold exceeded */ if (data.asc == 0x5D) |