Commit dd2ee9fb authored by HighPoint Linux Team's avatar HighPoint Linux Team Committed by Greg Kroah-Hartman

hptiop: avoid buffer overflow when returning sense data

patch 0fec02c9 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: default avatarHighPoint Linux Team <linux@highpoint-tech.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Acked-by: default avatarMatthew Wilcox <willy@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5120a468
...@@ -377,8 +377,9 @@ static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 tag) ...@@ -377,8 +377,9 @@ static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 tag)
scp->result = SAM_STAT_CHECK_CONDITION; scp->result = SAM_STAT_CHECK_CONDITION;
memset(&scp->sense_buffer, memset(&scp->sense_buffer,
0, sizeof(scp->sense_buffer)); 0, sizeof(scp->sense_buffer));
memcpy(&scp->sense_buffer, memcpy(&scp->sense_buffer, &req->sg_list,
&req->sg_list, le32_to_cpu(req->dataxfer_length)); min(sizeof(scp->sense_buffer),
le32_to_cpu(req->dataxfer_length)));
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment