Skip to content
Snippets Groups Projects
Commit 192d2f4c authored by Laszlo Ersek's avatar Laszlo Ersek Committed by Michael Roth
Browse files

scsi_target_send_command(): amend stable-1.6 port of the CVE-2013-4344 fix


The originally suggested fix for CVE-2013-4344 introduced a regression in
scsi_target_send_command() / REQUEST_SENSE; the third argument passed to
scsi_device_get_sense() -- for the "len" parameter -- ignored the
possibility of the guest SCSI driver requesting truncated (or shorter than
full) sense data.

This could result in (r->len > req->cmd.xfer) on return, which is not
valid SCSI.

The problem was addressed in the second round, and the commit on the
master branch (84642435) is correct. However the stable-1.6 branch (the
v1.6.1 release) has the original, regressive fix (commit fdcbe7d5); let's
update it.

Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
parent 9388fdb6
Branches stable-0.15
Tags v0.15.1
No related merge requests found
...@@ -460,7 +460,8 @@ static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf) ...@@ -460,7 +460,8 @@ static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf)
break; break;
case REQUEST_SENSE: case REQUEST_SENSE:
scsi_target_alloc_buf(&r->req, SCSI_SENSE_LEN); scsi_target_alloc_buf(&r->req, SCSI_SENSE_LEN);
r->len = scsi_device_get_sense(r->req.dev, r->buf, r->buf_len, r->len = scsi_device_get_sense(r->req.dev, r->buf,
MIN(req->cmd.xfer, r->buf_len),
(req->cmd.buf[1] & 1) == 0); (req->cmd.buf[1] & 1) == 0);
if (r->req.dev->sense_is_ua) { if (r->req.dev->sense_is_ua) {
scsi_device_unit_attention_reported(req->dev); scsi_device_unit_attention_reported(req->dev);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment