]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: checks: Don't attempt to read if we destroyed the connection.
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 9 Jul 2019 15:28:51 +0000 (17:28 +0200)
committerOlivier Houchard <cognet@ci0.org>
Wed, 10 Jul 2019 14:29:12 +0000 (16:29 +0200)
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.

src/checks.c

index d3920ce8da7981b9eac8b1bfe4dbd460f79d273a..a1fe015df4a41065ad7e2e87941555fc55b85518 100644 (file)
@@ -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