]> xenbits.xensource.com Git - qemu-xen-4.4-testing.git/commit
ide: Check array bounds before writing to io_buffer (CVE-2015-5154)
authorKevin Wolf <kwolf@redhat.com>
Wed, 3 Jun 2015 12:13:31 +0000 (14:13 +0200)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 29 Jul 2015 15:33:52 +0000 (16:33 +0100)
commiteb745741f519e6cf60a455bfba62a1acc0b5cfe2
tree6df3061b45ce965ab2aa0a7840189cb7bdd0d646
parentfd5c04144e204539f04e2f7994b12eef7724c31a
ide: Check array bounds before writing to io_buffer (CVE-2015-5154)

If the end_transfer_func of a command is called because enough data has
been read or written for the current PIO transfer, and it fails to
correctly call the command completion functions, the DRQ bit in the
status register and s->end_transfer_func may remain set. This allows the
guest to access further bytes in s->io_buffer beyond s->data_end, and
eventually overflowing the io_buffer.

One case where this currently happens is emulation of the ATAPI command
START STOP UNIT.

This patch fixes the problem by adding explicit array bounds checks
before accessing the buffer instead of relying on end_transfer_func to
function correctly.

[ This is XSA-138 / CVE-2015-5154. ]

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit d18ac5938d38ed9a9d51e380a2baf8343468f65d)
hw/ide.c