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.5.0-rc1~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5140d2b3070f211e6d8a0ad7cb0a190e8b6f3e28;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 f7ed20df..3cc22d77 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)