mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-18 18:19:39 -05:00
BUG/MEDIUM: ssl: SSL backend sessions used after free
This bug impacts only the backends. The sessions cached could be used after been freed because of a missing write lock into ssl_sock_handle_hs_error() when freeing such objects. This issue could be rarely reproduced and only with QUIC with difficulties (random CRYPTO data corruptions and instrumented code). Must be backported as far as 2.6.
This commit is contained in:
parent
dfe1de4335
commit
3e6d030ce2
1 changed files with 3 additions and 2 deletions
|
|
@ -6008,8 +6008,9 @@ void ssl_sock_handle_hs_error(struct connection *conn)
|
||||||
* another thread */
|
* another thread */
|
||||||
|
|
||||||
HA_RWLOCK_RDLOCK(SSL_SERVER_LOCK, &s->ssl_ctx.lock);
|
HA_RWLOCK_RDLOCK(SSL_SERVER_LOCK, &s->ssl_ctx.lock);
|
||||||
if (s->ssl_ctx.reused_sess[tid].ptr)
|
HA_RWLOCK_WRLOCK(SSL_SERVER_LOCK, &s->ssl_ctx.reused_sess[tid].sess_lock);
|
||||||
ha_free(&s->ssl_ctx.reused_sess[tid].ptr);
|
ha_free(&s->ssl_ctx.reused_sess[tid].ptr);
|
||||||
|
HA_RWLOCK_WRUNLOCK(SSL_SERVER_LOCK, &s->ssl_ctx.reused_sess[tid].sess_lock);
|
||||||
HA_RWLOCK_RDUNLOCK(SSL_SERVER_LOCK, &s->ssl_ctx.lock);
|
HA_RWLOCK_RDUNLOCK(SSL_SERVER_LOCK, &s->ssl_ctx.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue