Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fec02c9 authored by HighPoint Linux Team's avatar HighPoint Linux Team Committed by James Bottomley
Browse files

[SCSI] hptiop: avoid buffer overflow when returning sense data



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: default avatarHighPoint Linux Team <linux@highpoint-tech.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 7a39ac3f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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: