Blame SOURCES/kvm-curl-Keep-socket-until-the-end-of-curl_sock_cb.patch

4ec855
From 46598620c18de69d9565e662a47d2615984cc49b Mon Sep 17 00:00:00 2001
4ec855
From: Max Reitz <mreitz@redhat.com>
4ec855
Date: Tue, 19 Nov 2019 15:29:55 +0000
4ec855
Subject: [PATCH 3/8] curl: Keep *socket until the end of curl_sock_cb()
4ec855
MIME-Version: 1.0
4ec855
Content-Type: text/plain; charset=UTF-8
4ec855
Content-Transfer-Encoding: 8bit
4ec855
4ec855
RH-Author: Max Reitz <mreitz@redhat.com>
4ec855
Message-id: <20191119153000.101646-3-mreitz@redhat.com>
4ec855
Patchwork-id: 92517
4ec855
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH 2/7] curl: Keep *socket until the end of curl_sock_cb()
4ec855
Bugzilla: 1744602
4ec855
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
4ec855
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4ec855
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
4ec855
4ec855
This does not really change anything, but it makes the code a bit easier
4ec855
to follow once we use @socket as the opaque pointer for
4ec855
aio_set_fd_handler().
4ec855
4ec855
Cc: qemu-stable@nongnu.org
4ec855
Signed-off-by: Max Reitz <mreitz@redhat.com>
4ec855
Message-id: 20190910124136.10565-3-mreitz@redhat.com
4ec855
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
4ec855
Reviewed-by: John Snow <jsnow@redhat.com>
4ec855
Signed-off-by: Max Reitz <mreitz@redhat.com>
4ec855
(cherry picked from commit 007f339b1099af46a008dac438ca0943e31dba72)
4ec855
Signed-off-by: Max Reitz <mreitz@redhat.com>
4ec855
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
4ec855
---
4ec855
 block/curl.c | 10 +++++-----
4ec855
 1 file changed, 5 insertions(+), 5 deletions(-)
4ec855
4ec855
diff --git a/block/curl.c b/block/curl.c
4ec855
index fa602d1..b3fe09f 100644
4ec855
--- a/block/curl.c
4ec855
+++ b/block/curl.c
4ec855
@@ -181,10 +181,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
4ec855
 
4ec855
     QLIST_FOREACH(socket, &state->sockets, next) {
4ec855
         if (socket->fd == fd) {
4ec855
-            if (action == CURL_POLL_REMOVE) {
4ec855
-                QLIST_REMOVE(socket, next);
4ec855
-                g_free(socket);
4ec855
-            }
4ec855
             break;
4ec855
         }
4ec855
     }
4ec855
@@ -194,7 +190,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
4ec855
         socket->state = state;
4ec855
         QLIST_INSERT_HEAD(&state->sockets, socket, next);
4ec855
     }
4ec855
-    socket = NULL;
4ec855
 
4ec855
     DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, (int)fd);
4ec855
     switch (action) {
4ec855
@@ -216,6 +211,11 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
4ec855
             break;
4ec855
     }
4ec855
 
4ec855
+    if (action == CURL_POLL_REMOVE) {
4ec855
+        QLIST_REMOVE(socket, next);
4ec855
+        g_free(socket);
4ec855
+    }
4ec855
+
4ec855
     return 0;
4ec855
 }
4ec855
 
4ec855
-- 
4ec855
1.8.3.1
4ec855