OSDN Git Service

ivshmem: Check ivshmem_read() size argument
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 15 Sep 2014 16:40:05 +0000 (18:40 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 31 Oct 2014 16:01:44 +0000 (17:01 +0100)
commita2e9011b4164894594bf0b2a2a59e9c55c58c17b
tree944ce67af7f759c6fa731e9d15c85385ef8e2c0d
parente64e353590c2584b41cd1db925f67042a05f4250
ivshmem: Check ivshmem_read() size argument

The third argument to the fd_read() callback implemented by
ivshmem_read() is the number of bytes, not a flags field.  Fix this and
check we received enough bytes before accessing the buffer pointer.

Cc: Cam Macdonell <cam@cs.ualberta.ca>
Reported-by: Sebastian Krahmer <krahmer@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
[AF: Handle partial reads via FIFO]
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/misc/ivshmem.c