Skip to content
Snippets Groups Projects
Commit e2a3a219 authored by Marc-André Lureau's avatar Marc-André Lureau
Browse files

aio/win32: aio_set_fd_handler() only supports SOCKET


Let's check if the argument is actually a SOCKET, else report an error
and return.

Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarStefan Berger <stefanb@linux.ibm.com>
Message-Id: <20230221124802.4103554-10-marcandre.lureau@redhat.com>
parent 6eeef447
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "qemu/sockets.h" #include "qemu/sockets.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/rcu_queue.h" #include "qemu/rcu_queue.h"
#include "qemu/error-report.h"
struct AioHandler { struct AioHandler {
EventNotifier *e; EventNotifier *e;
...@@ -70,10 +71,14 @@ void aio_set_fd_handler(AioContext *ctx, ...@@ -70,10 +71,14 @@ void aio_set_fd_handler(AioContext *ctx,
IOHandler *io_poll_ready, IOHandler *io_poll_ready,
void *opaque) void *opaque)
{ {
/* fd is a SOCKET in our case */
AioHandler *old_node; AioHandler *old_node;
AioHandler *node = NULL; AioHandler *node = NULL;
if (!fd_is_socket(fd)) {
error_report("fd=%d is not a socket, AIO implementation is missing", fd);
return;
}
qemu_lockcnt_lock(&ctx->list_lock); qemu_lockcnt_lock(&ctx->list_lock);
QLIST_FOREACH(old_node, &ctx->aio_handlers, node) { QLIST_FOREACH(old_node, &ctx->aio_handlers, node) {
if (old_node->pfd.fd == fd && !old_node->deleted) { if (old_node->pfd.fd == fd && !old_node->deleted) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment