aboutsummaryrefslogtreecommitdiff
path: root/hw/misc
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2015-06-23 12:55:41 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2015-10-24 18:02:49 +0200
commit945001a1af36eafd093b6b1582f5282932cd3d87 (patch)
tree2141a00cef0f4d8f0afc7a4888210aeb929b8ab2 /hw/misc
parent86d471bfa4262fa983c0214ace7336843e2181a2 (diff)
ivshmem: check shm isn't already initialized
The server should not change the shm, and this isn't handled by qemu and we should should verify this in qemu. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
Diffstat (limited to 'hw/misc')
-rw-r--r--hw/misc/ivshmem.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index d3d02048cd..9023f95711 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -533,6 +533,12 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size)
if (incoming_posn == -1) {
void * map_ptr;
+ if (s->shm_fd >= 0) {
+ error_report("shm already initialized");
+ close(incoming_fd);
+ return;
+ }
+
if (check_shm_size(s, incoming_fd, &err) == -1) {
error_report_err(err);
close(incoming_fd);