[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 09/25] aio/win32: aio_set_fd_handler() only supports SOCKET
From: |
marcandre . lureau |
Subject: |
[PULL v2 09/25] aio/win32: aio_set_fd_handler() only supports SOCKET |
Date: |
Mon, 13 Mar 2023 15:46:32 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Let's check if the argument is actually a SOCKET, else report an error
and return.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Message-Id: <20230221124802.4103554-10-marcandre.lureau@redhat.com>
---
util/aio-win32.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/util/aio-win32.c b/util/aio-win32.c
index 74d63fa21e..08e8f5615d 100644
--- a/util/aio-win32.c
+++ b/util/aio-win32.c
@@ -22,6 +22,7 @@
#include "qemu/sockets.h"
#include "qapi/error.h"
#include "qemu/rcu_queue.h"
+#include "qemu/error-report.h"
struct AioHandler {
EventNotifier *e;
@@ -70,10 +71,14 @@ void aio_set_fd_handler(AioContext *ctx,
IOHandler *io_poll_ready,
void *opaque)
{
- /* fd is a SOCKET in our case */
AioHandler *old_node;
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);
QLIST_FOREACH(old_node, &ctx->aio_handlers, node) {
if (old_node->pfd.fd == fd && !old_node->deleted) {
--
2.39.2
- [PULL v2 00/25] Win socket patches, marcandre . lureau, 2023/03/13
- [PULL v2 01/25] util: drop qemu_fork(), marcandre . lureau, 2023/03/13
- [PULL v2 02/25] tests: use closesocket(), marcandre . lureau, 2023/03/13
- [PULL v2 03/25] io: use closesocket(), marcandre . lureau, 2023/03/13
- [PULL v2 05/25] error: add global &error_warn destination, marcandre . lureau, 2023/03/13
- [PULL v2 06/25] win32/socket: introduce qemu_socket_select() helper, marcandre . lureau, 2023/03/13
- [PULL v2 04/25] tests: add test-error-report, marcandre . lureau, 2023/03/13
- [PULL v2 07/25] win32/socket: introduce qemu_socket_unselect() helper, marcandre . lureau, 2023/03/13
- [PULL v2 08/25] aio: make aio_set_fd_poll() static to aio-posix.c, marcandre . lureau, 2023/03/13
- [PULL v2 09/25] aio/win32: aio_set_fd_handler() only supports SOCKET,
marcandre . lureau <=
- [PULL v2 10/25] main-loop: remove qemu_fd_register(), win32/slirp/socket specific, marcandre . lureau, 2023/03/13
- [PULL v2 11/25] slirp: unregister the win32 SOCKET, marcandre . lureau, 2023/03/13
- [PULL v2 12/25] slirp: open-code qemu_socket_(un)select(), marcandre . lureau, 2023/03/13
- [PULL v2 13/25] win32: avoid mixing SOCKET and file descriptor space, marcandre . lureau, 2023/03/13
- [PULL v2 14/25] os-posix: remove useless ioctlsocket() define, marcandre . lureau, 2023/03/13
- [PULL v2 15/25] win32: replace closesocket() with close() wrapper, marcandre . lureau, 2023/03/13
- [PULL v2 16/25] tests: fix path separator, use g_build_filename(), marcandre . lureau, 2023/03/13
- [PULL v2 17/25] char: do not double-close fd when failing to add client, marcandre . lureau, 2023/03/13
- [PULL v2 18/25] tests/docker: fix a win32 error due to portability, marcandre . lureau, 2023/03/13
- [PULL v2 20/25] qmp: 'add_client' actually expects sockets, marcandre . lureau, 2023/03/13