From: Andy Pan Date: Thu, 12 Dec 2024 12:48:56 +0000 (+0000) Subject: [PATCH] async-thread: avoid closing eventfd twice X-Git-Tag: archive/raspbian/8.12.0+git20250209.89ed161+ds-1+rpi1~1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=48c53c687981c3f36dadcac999de3d9b554e0983;p=curl.git [PATCH] async-thread: avoid closing eventfd twice When employing eventfd for socketpair, there is only one file descriptor. Closing that fd twice might result in fd corruption. Thus, we should avoid closing the eventfd twice, following the pattern in lib/multi.c. Fixes #15725 Closes #15727 Reported-by: Christian Heusel Gbp-Pq: Name async_thread_avoid_closing_eventfd_twice.patch --- diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c index a58e4b79..32d496b1 100644 --- a/lib/asyn-thread.c +++ b/lib/asyn-thread.c @@ -195,9 +195,11 @@ void destroy_thread_sync_data(struct thread_sync_data *tsd) * close one end of the socket pair (may be done in resolver thread); * the other end (for reading) is always closed in the parent thread. */ +#ifndef USE_EVENTFD if(tsd->sock_pair[1] != CURL_SOCKET_BAD) { wakeup_close(tsd->sock_pair[1]); } +#endif #endif memset(tsd, 0, sizeof(*tsd)); }