esp: check dma length before reading scsi command(CVE-2016-4441)
commit9b28a7fc883f570f7aef582721deb16fd743bee4
authorPrasad J Pandit <pjp@fedoraproject.org>
Thu, 19 May 2016 10:39:31 +0000 (19 16:09 +0530)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 4 Aug 2016 21:42:05 +0000 (4 16:42 -0500)
tree5765ccb4195778ba91f82d28c88c7a433fa07a01
parent0a5e3685ea10c578f8063ca0dbb009af45693d85
esp: check dma length before reading scsi command(CVE-2016-4441)

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() uses DMA to read scsi commands into this buffer.
Add check to validate DMA length against buffer size to avoid any
overrun.

Fixes CVE-2016-4441.

Reported-by: Li Qiang <liqiang6-s@360.cn>
Cc: qemu-stable@nongnu.org
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <1463654371-11169-3-git-send-email-ppandit@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 6c1fef6b59563cc415f21e03f81539ed4b33ad90)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/scsi/esp.c