eaa6ce4fe2
CVE-2017-5525: audio: memory leakage in ac97 (bz #1414110) CVE-2017-5526: audio: memory leakage in es1370 (bz #1414210) CVE-2016-10155 watchdog: memory leakage in i6300esb (bz #1415200) CVE-2017-5552: virtio-gpu-3d: memory leakage (bz #1415283) CVE-2017-5578: virtio-gpu: memory leakage (bz #1415797) CVE-2017-5667: sd: sdhci OOB access during multi block transfer (bz #1417560) CVE-2017-5856: scsi: megasas: memory leakage (bz #1418344) CVE-2017-5857: virtio-gpu-3d: host memory leakage in virgl_cmd_resource_unref (bz #1418383) CVE-2017-5898: usb: integer overflow in emulated_apdu_from_guest (bz #1419700) CVE-2017-5987: sd: infinite loop issue in multi block transfers (bz #1422001) CVE-2017-6058: vmxnet3: OOB access when doing vlan stripping (bz #1423359) CVE-2017-6505: usb: an infinite loop issue in ohci_service_ed_list (bz #1429434) CVE-2017-2615: cirrus: oob access while doing bitblt copy backward (bz #1418206) CVE-2017-2620: cirrus: potential arbitrary code execution (bz #1425419) Fix spice GL with new mesa/libglvnd (bz #1431905)
62 lines
2.2 KiB
Diff
62 lines
2.2 KiB
Diff
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
Date: Mon, 2 Jan 2017 11:03:33 +0100
|
|
Subject: [PATCH] megasas: fix guest-triggered memory leak
|
|
|
|
If the guest sets the sglist size to a value >=2GB, megasas_handle_dcmd
|
|
will return MFI_STAT_MEMORY_NOT_AVAILABLE without freeing the memory.
|
|
Avoid this by returning only the status from map_dcmd, and loading
|
|
cmd->iov_size in the caller.
|
|
|
|
Reported-by: Li Qiang <liqiang6-s@360.cn>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
(cherry picked from commit 765a707000e838c30b18d712fe6cb3dd8e0435f3)
|
|
---
|
|
hw/scsi/megasas.c | 11 ++++++-----
|
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
|
|
index 52a4123..ebf0302 100644
|
|
--- a/hw/scsi/megasas.c
|
|
+++ b/hw/scsi/megasas.c
|
|
@@ -672,14 +672,14 @@ static int megasas_map_dcmd(MegasasState *s, MegasasCmd *cmd)
|
|
trace_megasas_dcmd_invalid_sge(cmd->index,
|
|
cmd->frame->header.sge_count);
|
|
cmd->iov_size = 0;
|
|
- return -1;
|
|
+ return -EINVAL;
|
|
}
|
|
iov_pa = megasas_sgl_get_addr(cmd, &cmd->frame->dcmd.sgl);
|
|
iov_size = megasas_sgl_get_len(cmd, &cmd->frame->dcmd.sgl);
|
|
pci_dma_sglist_init(&cmd->qsg, PCI_DEVICE(s), 1);
|
|
qemu_sglist_add(&cmd->qsg, iov_pa, iov_size);
|
|
cmd->iov_size = iov_size;
|
|
- return cmd->iov_size;
|
|
+ return 0;
|
|
}
|
|
|
|
static void megasas_finish_dcmd(MegasasCmd *cmd, uint32_t iov_size)
|
|
@@ -1552,19 +1552,20 @@ static const struct dcmd_cmd_tbl_t {
|
|
|
|
static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd)
|
|
{
|
|
- int opcode, len;
|
|
+ int opcode;
|
|
int retval = 0;
|
|
+ size_t len;
|
|
const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl;
|
|
|
|
opcode = le32_to_cpu(cmd->frame->dcmd.opcode);
|
|
trace_megasas_handle_dcmd(cmd->index, opcode);
|
|
- len = megasas_map_dcmd(s, cmd);
|
|
- if (len < 0) {
|
|
+ if (megasas_map_dcmd(s, cmd) < 0) {
|
|
return MFI_STAT_MEMORY_NOT_AVAILABLE;
|
|
}
|
|
while (cmdptr->opcode != -1 && cmdptr->opcode != opcode) {
|
|
cmdptr++;
|
|
}
|
|
+ len = cmd->iov_size;
|
|
if (cmdptr->opcode == -1) {
|
|
trace_megasas_dcmd_unhandled(cmd->index, opcode, len);
|
|
retval = megasas_dcmd_dummy(s, cmd);
|