diff options
author | HighPoint Linux Team <linux@highpoint-tech.com> | 2007-10-16 14:28:24 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-21 09:25:55 -0800 |
commit | dd2ee9fbafad8ec8b5f5c0b325d149c168b42155 (patch) | |
tree | 75f3dd1390d314b87b6111f072170c0cf31a9d0c /drivers | |
parent | 5120a468e1b3a7d01bb043884ed377ff1c0cc653 (diff) |
hptiop: avoid buffer overflow when returning sense data
patch 0fec02c93f60fb44ba3a24a0d3e4a52521d34d3f in mainline.
avoid buffer overflow when returning sense data.
With current adapter firmware the driver is working but future firmware
updates may return sense data larger than 96 bytes, causing overflow on
scp->sense_buffer and a kernel crash.
This fix should be backported to earlier kernels.
Signed-off-by: HighPoint Linux Team <linux@highpoint-tech.com>
Signed-off-by: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/hptiop.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index bec83cbee59..7e40105dd2b 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c @@ -377,8 +377,9 @@ static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 tag) scp->result = SAM_STAT_CHECK_CONDITION; memset(&scp->sense_buffer, 0, sizeof(scp->sense_buffer)); - memcpy(&scp->sense_buffer, - &req->sg_list, le32_to_cpu(req->dataxfer_length)); + memcpy(&scp->sense_buffer, &req->sg_list, + min(sizeof(scp->sense_buffer), + le32_to_cpu(req->dataxfer_length))); break; default: |