]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Explicitly stop reading before closing the nmtcpsocket
authorOndřej Surý <ondrej@sury.org>
Tue, 20 Oct 2020 18:57:19 +0000 (20:57 +0200)
committerEvan Hunt <each@isc.org>
Thu, 22 Oct 2020 18:37:16 +0000 (11:37 -0700)
When closing the socket that is actively reading from the stream, the
read_cb() could be called between uv_close() and close callback when the
server socket has been already detached hence using sock->statichandle
after it has been already freed.

lib/isc/netmgr/tcp.c

index 6c9bcb47d176043d4f9a387584024edb3de71a8d..b935b94dbddd7a753c72b5c3aa559edc135280d3 100644 (file)
@@ -1115,6 +1115,9 @@ tcp_close_direct(isc_nmsocket_t *sock) {
        if (sock->quota != NULL) {
                isc_quota_detach(&sock->quota);
        }
+
+       uv_read_stop((uv_stream_t *)&sock->uv_handle.handle);
+
        if (sock->timer_initialized) {
                sock->timer_initialized = false;
                uv_timer_stop(&sock->timer);