summary refs log tree commit diff stats
path: root/include/hw/qdev-core.h
diff options
context:
space:
mode:
authorDima Stepanov <dimastep@yandex-team.ru>2018-06-13 11:19:54 +0300
committerThomas Huth <thuth@redhat.com>2018-09-25 17:26:18 +0200
commit1e7ec6cf067025552bb10def7c49f4527d2f035f (patch)
tree2d70a6908abe8cf382eebdd98f78d2dd7ceedc9f /include/hw/qdev-core.h
parent91c082ad86e96ee342faaa024d46fd3e6242a98e (diff)
downloadfocaccia-qemu-1e7ec6cf067025552bb10def7c49f4527d2f035f.tar.gz
focaccia-qemu-1e7ec6cf067025552bb10def7c49f4527d2f035f.zip
memfd: fix possible usage of the uninitialized file descriptor
The qemu_memfd_alloc_check() routine allocates the fd variable on stack.
This variable is initialized inside the qemu_memfd_alloc() function.
There are several cases when *fd will be left unintialized which can
lead to the unexpected close() in the qemu_memfd_free() call.

Set file descriptor to -1 before calling the qemu_memfd_alloc routine.

Signed-off-by: Dima Stepanov <dimastep@yandex-team.ru>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'include/hw/qdev-core.h')
0 files changed, 0 insertions, 0 deletions