event_notifier: prevent accidental use after close
commitaa262928595d431bfee7914cb7d9d79197f887a2
authorHalil Pasic <pasic@linux.vnet.ibm.com>
Thu, 2 Mar 2017 18:13:08 +0000 (2 19:13 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 28 Mar 2017 23:35:23 +0000 (29 02:35 +0300)
tree8dfbad003754d9e9707f272609c656c248ab842a
parentdf9046363220e57d45818312759b954c033c58ab
event_notifier: prevent accidental use after close

Let's set the handles to the underlying facilities to their extremal
value so no accidental misuse can happen, and to make it obvious that the
notifier is dysfunctional. E.g. if we just close an fd but do not touch
the int holding the fd eventually a read/write could succeed again when
the fd gets reused, and corrupt the file addressed by the fd.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
util/event_notifier-posix.c
util/event_notifier-win32.c