From: Olivier Houchard Date: Tue, 9 Jul 2019 15:28:51 +0000 (+0200) Subject: BUG/MEDIUM: checks: Don't attempt to read if we destroyed the connection. X-Git-Tag: v2.1-dev1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc89ad8d94246eca064b87e76c1897f6a950f6fb;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: checks: Don't attempt to read if we destroyed the connection. In event_srv_chk_io(), only call __event_srv_chk_r() if we did not subscribe for reading, and if wake_srv_chk() didn't return -1, as it would mean it just destroyed the connection and the conn_stream, and attempting to use those to recv data would lead to a crash. This should be backported to 1.9 and 2.0. --- diff --git a/src/checks.c b/src/checks.c index d3920ce8da..a1fe015df4 100644 --- a/src/checks.c +++ b/src/checks.c @@ -716,10 +716,11 @@ static struct task *event_srv_chk_io(struct task *t, void *ctx, unsigned short s struct check *check = ctx; struct conn_stream *cs = check->cs; struct email_alertq *q = container_of(check, typeof(*q), check); + int ret = 0; if (!(check->wait_list.events & SUB_RETRY_SEND)) - wake_srv_chk(cs); - if (!(check->wait_list.events & SUB_RETRY_RECV)) { + ret = wake_srv_chk(cs); + if (ret == 0 && !(check->wait_list.events & SUB_RETRY_RECV)) { if (check->server) HA_SPIN_LOCK(SERVER_LOCK, &check->server->lock); else