From: Mathieu Desnoyers Date: Fri, 23 May 2014 13:26:11 +0000 (-0400) Subject: Fix: refuse overwrite mode buffers with less than two subbuffers X-Git-Tag: v2.4.2~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d6716789991fba4aaf7cf5899a3270c6d9e35e95;p=lttng-modules.git Fix: refuse overwrite mode buffers with less than two subbuffers Fixes #793 Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/ringbuffer/ring_buffer_backend.c b/lib/ringbuffer/ring_buffer_backend.c index 8e1a796a..75bed817 100644 --- a/lib/ringbuffer/ring_buffer_backend.c +++ b/lib/ringbuffer/ring_buffer_backend.c @@ -331,6 +331,12 @@ int channel_backend_init(struct channel_backend *chanb, return -EINVAL; if (!num_subbuf || (num_subbuf & (num_subbuf - 1))) return -EINVAL; + /* + * Overwrite mode buffers require at least 2 subbuffers per + * buffer. + */ + if (config->mode == RING_BUFFER_OVERWRITE && num_subbuf < 2) + return -EINVAL; ret = subbuffer_id_check_index(config, num_subbuf); if (ret)