[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 26/30] scsi: esp: check buffer length before reading
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 26/30] scsi: esp: check buffer length before reading scsi command |
Date: |
Thu, 16 Jun 2016 16:16:21 +0200 |
From: Prasad J Pandit <address@hidden>
The 53C9X Fast SCSI Controller(FSC) comes with an internal 16-byte
FIFO buffer. It is used to handle command and data transfer.
Routine get_cmd() in non-DMA mode, uses 'ti_size' to read scsi
command into a buffer. Add check to validate command length against
buffer size to avoid any overrun.
Reported-by: Li Qiang <address@hidden>
Signed-off-by: Prasad J Pandit <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/scsi/esp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 3adb685..4b94bbc 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -98,6 +98,9 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf, uint8_t
buflen)
s->dma_memory_read(s->dma_opaque, buf, dmalen);
} else {
dmalen = s->ti_size;
+ if (dmalen > TI_BUFSZ) {
+ return 0;
+ }
memcpy(buf, s->ti_buf, dmalen);
buf[0] = buf[2] >> 5;
}
--
2.5.5
- [Qemu-devel] [PULL 11/30] nbd: simplify the nbd_request and nbd_reply structs, (continued)
- [Qemu-devel] [PULL 11/30] nbd: simplify the nbd_request and nbd_reply structs, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 16/30] vl.c: Add '-L help' which lists data dirs., Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 15/30] KVM: use KVM_CAP_MAX_VCPU_ID, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 17/30] nbd: Use BDRV_REQ_FUA for better FUA where supported, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 21/30] nbd: Reject unknown request flags, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 20/30] nbd: Improve server handling of bogus commands, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 18/30] nbd: More debug typo fixes, use correct formats, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 19/30] nbd: Quit server after any write error, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 23/30] nbd: Clean up ioctl handling of qemu-nbd -c, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 22/30] nbd: Group all Linux-specific ioctl code in one place, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 26/30] scsi: esp: check buffer length before reading scsi command,
Paolo Bonzini <=
- [Qemu-devel] [PULL 25/30] nbd: Avoid magic number for NBD max name size, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 24/30] nbd: Detect servers that send unexpected error values, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 29/30] scsi: esp: make cmdbuf big enough for maximum CDB size, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 27/30] scsi: esp: respect FIFO invariant after message phase, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 30/30] vl: smp_parse: cleanups, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 28/30] scsi: esp: clean up handle_ti/esp_do_dma if s->do_cmd, Paolo Bonzini, 2016/06/16
- Re: [Qemu-devel] [PULL 00/30] KVM, build, NBD, SCSI patches for 2016-06-16, Peter Maydell, 2016/06/16