]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix dangling uvreq when data is sent from tlsdns_cycle()
authorOndřej Surý <ondrej@isc.org>
Fri, 29 Jan 2021 12:00:46 +0000 (13:00 +0100)
committerOndřej Surý <ondrej@isc.org>
Thu, 18 Mar 2021 16:58:56 +0000 (17:58 +0100)
The tlsdns_cycle() might call uv_write() to write data to the socket,
when this happens and the socket is shutdown before the callback
completes, the uvreq structure was not freed because the callback would
be called with non-zero status code.

lib/isc/netmgr/tlsdns.c

index 0e79a110d11958e8911c200461930e5c1b6ab4a1..d03bd69a8ee6241644d387cc4b22870af99175b4 100644 (file)
@@ -1079,13 +1079,13 @@ tls_write_cb(uv_write_t *req, int status) {
 
        free_senddata(sock);
 
+       isc__nm_uvreq_put(&uvreq, sock);
+
        if (status != 0) {
                tls_error(sock, isc__nm_uverr2result(status));
                return;
        }
 
-       isc__nm_uvreq_put(&uvreq, sock);
-
        result = tls_cycle(sock);
        if (result != ISC_R_SUCCESS) {
                tls_error(sock, result);