Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
xen.3680
CVE-2016-6351-qemuu-scsi-esp-make-cmdbuf-big-en...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File CVE-2016-6351-qemuu-scsi-esp-make-cmdbuf-big-enough-for-maximum-CDB-size.patch of Package xen.3680
References: bsc#990843 CVE-2016-6351 Subject: scsi: esp: make cmdbuf big enough for maximum CDB size From: Prasad J Pandit pjp@fedoraproject.org Thu Jun 16 00:22:35 2016 +0200 Date: Thu Jun 16 18:39:05 2016 +0200: Git: 926cde5f3e4d2504ed161ed0cb771ac7cad6fd11 While doing DMA read into ESP command buffer 's->cmdbuf', it could write past the 's->cmdbuf' area, if it was transferring more than 16 bytes. Increase the command buffer size to 32, which is maximum when 's->do_cmd' is set, and add a check on 'len' to avoid OOB access. Reported-by: Li Qiang <liqiang6-s@360.cn> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Index: xen-4.4.4-testing/tools/qemu-xen-dir-remote/hw/scsi/esp.c =================================================================== --- xen-4.4.4-testing.orig/tools/qemu-xen-dir-remote/hw/scsi/esp.c +++ xen-4.4.4-testing/tools/qemu-xen-dir-remote/hw/scsi/esp.c @@ -247,6 +247,8 @@ static void esp_do_dma(ESPState *s) len = s->dma_left; if (s->do_cmd) { trace_esp_do_dma(s->cmdlen, len); + assert (s->cmdlen <= sizeof(s->cmdbuf) && + len <= sizeof(s->cmdbuf) - s->cmdlen); s->dma_memory_read(s->dma_opaque, &s->cmdbuf[s->cmdlen], len); s->ti_size = 0; s->cmdlen = 0; @@ -346,7 +348,7 @@ static void handle_ti(ESPState *s) s->dma_counter = dmalen; if (s->do_cmd) - minlen = (dmalen < 32) ? dmalen : 32; + minlen = (dmalen < ESP_CMDBUF_SZ) ? dmalen : ESP_CMDBUF_SZ; else if (s->ti_size < 0) minlen = (dmalen < -s->ti_size) ? dmalen : -s->ti_size; else @@ -443,7 +445,7 @@ void esp_reg_write(ESPState *s, uint32_t break; case ESP_FIFO: if (s->do_cmd) { - if (s->cmdlen < TI_BUFSZ) { + if (s->cmdlen < ESP_CMDBUF_SZ) { s->cmdbuf[s->cmdlen++] = val & 0xff; } else { trace_esp_error_fifo_overrun(); Index: xen-4.4.4-testing/tools/qemu-xen-dir-remote/include/hw/scsi/esp.h =================================================================== --- xen-4.4.4-testing.orig/tools/qemu-xen-dir-remote/include/hw/scsi/esp.h +++ xen-4.4.4-testing/tools/qemu-xen-dir-remote/include/hw/scsi/esp.h @@ -14,6 +14,7 @@ void esp_init(hwaddr espaddr, int it_shi #define ESP_REGS 16 #define TI_BUFSZ 16 +#define ESP_CMDBUF_SZ 32 typedef struct ESPState ESPState; @@ -30,7 +31,7 @@ struct ESPState { SCSIBus bus; SCSIDevice *current_dev; SCSIRequest *current_req; - uint8_t cmdbuf[TI_BUFSZ]; + uint8_t cmdbuf[ESP_CMDBUF_SZ]; uint32_t cmdlen; uint32_t do_cmd;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor