Fixed TLS connection shutdown on errors.
An immediate return statement on connection errors was mistakenly added to the beginning of nxt_openssl_conn_io_shutdown() in ecd3c5bbf7d8, breaking the TLS connection finalization procedure. As a result, a TLS connection was left unfinalized if it had been closed prematurely or a fatal protocol error had occurred, which caused memory and socket descriptor leakage. Moreover, in some cases (notably, on handshake errors in tests with kqueue on macOS) the read event was triggered later and nxt_h1p_conn_error() was called the second time; after the change in af93c866b4f0, the latter call crashed the router process in an attempt to remove a connection from the idle queue twice.
This commit is contained in:
@@ -9,6 +9,20 @@
|
|||||||
date="" time=""
|
date="" time=""
|
||||||
packager="Andrei Belov <defan@nginx.com>">
|
packager="Andrei Belov <defan@nginx.com>">
|
||||||
|
|
||||||
|
<change type="bugfix">
|
||||||
|
<para>
|
||||||
|
the router process could crash on premature TLS connection close; the bug had
|
||||||
|
appeared in 1.17.0.
|
||||||
|
</para>
|
||||||
|
</change>
|
||||||
|
|
||||||
|
<change type="bugfix">
|
||||||
|
<para>
|
||||||
|
a connection leak occurring on premature TLS connection close; the bug had
|
||||||
|
appeared in 1.6.
|
||||||
|
</para>
|
||||||
|
</change>
|
||||||
|
|
||||||
<change type="bugfix">
|
<change type="bugfix">
|
||||||
<para>
|
<para>
|
||||||
a descriptor leak occurring in the router process when removing or
|
a descriptor leak occurring in the router process when removing or
|
||||||
|
|||||||
@@ -720,10 +720,6 @@ nxt_openssl_conn_io_shutdown(nxt_task_t *task, void *obj, void *data)
|
|||||||
|
|
||||||
nxt_debug(task, "openssl conn shutdown fd:%d", c->socket.fd);
|
nxt_debug(task, "openssl conn shutdown fd:%d", c->socket.fd);
|
||||||
|
|
||||||
if (c->socket.error != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
c->read_state = NULL;
|
c->read_state = NULL;
|
||||||
tls = c->u.tls;
|
tls = c->u.tls;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user