Skip to content

Commit

Permalink
[SCSI] hptiop: avoid buffer overflow when returning sense data
Browse files Browse the repository at this point in the history
The newer firmware may return more than 96 bytes of sense data when it
does autosense.  Truncate this to the size of the SCSI layer sense
buffer to avoid an overrun.

Signed-off-by: HighPoint Linux Team <linux@highpoint-tech.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
HighPoint Linux Team authored and James Bottomley committed Oct 18, 2007
1 parent 7a39ac3 commit 0fec02c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/scsi/hptiop.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,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:
Expand Down

0 comments on commit 0fec02c

Please sign in to comment.