From: Christopher Faulet Date: Fri, 10 Nov 2017 10:54:58 +0000 (+0100) Subject: BUG/MINOR: spoe: check buffer size before acquiring or releasing it X-Git-Tag: v1.8-rc4~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=600d37edda6a4aebeffe85da97cd7277b5f2c217;p=thirdparty%2Fhaproxy.git BUG/MINOR: spoe: check buffer size before acquiring or releasing it In spoe_acquire_buffer and spoe_release_buffer, instead of checking the buffer against buf_empty, we now check its size. It is important because when an allocation fails, it will be set to buf_wanted. In both cases, the size is 0. It is a proactive bug fix, no real problem was observed till now. It cannot be backported as is in 1.7 because of all changes made on the SPOE in 1.8. --- diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 5a8c9e6137..ea4675cb76 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -2695,7 +2695,7 @@ spoe_process_event(struct stream *s, struct spoe_context *ctx, static int spoe_acquire_buffer(struct buffer **buf, struct buffer_wait *buffer_wait) { - if (*buf != &buf_empty) + if ((*buf)->size) return 1; if (!LIST_ISEMPTY(&buffer_wait->list)) { @@ -2725,7 +2725,7 @@ spoe_release_buffer(struct buffer **buf, struct buffer_wait *buffer_wait) } /* Release the buffer if needed */ - if (*buf != &buf_empty) { + if ((*buf)->size) { b_free(buf); offer_buffers(buffer_wait->target, tasks_run_queue + applets_active_queue);