335584f502
CVE-2017-8309: audio: host memory lekage via capture buffer (bz #1446520) CVE-2017-8379: input: host memory lekage via keyboard events (bz #1446560) CVE-2017-8380: scsi: megasas: out-of-bounds read in megasas_mmio_write (bz #1446578) CVE-2017-7493: 9pfs: guest privilege escalation in virtfs mapped-file mode (bz #1451711) CVE-2017-9503: megasas: null pointer dereference while processing megasas command (bz #1459478) CVE-2017-10806: usb-redirect: stack buffer overflow in debug logging (bz #1468497) CVE-2017-9524: nbd: segfault due to client non-negotiation (bz #1460172) CVE-2017-10664: qemu-nbd: server breaks with SIGPIPE upon client abort (bz #1466192)
31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
Date: Thu, 1 Jun 2017 17:18:39 +0200
|
|
Subject: [PATCH] megasas: do not read sense length more than once from frame
|
|
|
|
Avoid TOC-TOU bugs depending on how the compiler behaves.
|
|
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
(cherry picked from commit 134550bf81a026e18cf58b81e2c2cceaf516f92e)
|
|
---
|
|
hw/scsi/megasas.c | 6 ++++--
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
|
|
index 804122ab05..1888118e5f 100644
|
|
--- a/hw/scsi/megasas.c
|
|
+++ b/hw/scsi/megasas.c
|
|
@@ -309,9 +309,11 @@ static int megasas_build_sense(MegasasCmd *cmd, uint8_t *sense_ptr,
|
|
PCIDevice *pcid = PCI_DEVICE(cmd->state);
|
|
uint32_t pa_hi = 0, pa_lo;
|
|
hwaddr pa;
|
|
+ int frame_sense_len;
|
|
|
|
- if (sense_len > cmd->frame->header.sense_len) {
|
|
- sense_len = cmd->frame->header.sense_len;
|
|
+ frame_sense_len = cmd->frame->header.sense_len;
|
|
+ if (sense_len > frame_sense_len) {
|
|
+ sense_len = frame_sense_len;
|
|
}
|
|
if (sense_len) {
|
|
pa_lo = le32_to_cpu(cmd->frame->pass.sense_addr_lo);
|