Fix: deny overwrite mode and num subbuf less than 2
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index 339a7659e5ae63b00d8547d6ac47656cb81e69a8..9ef9686bd40b3c29727451a9d52d11a4367e64f0 100644 (file)
@@ -850,6 +850,16 @@ int cmd_enable_channel(struct ltt_session *session,
 
        rcu_read_lock();
 
+       /*
+        * The ringbuffer (both in user space and kernel) behave badly in overwrite
+        * mode and with less than 2 subbuf so block it right away and send back an
+        * invalid attribute error.
+        */
+       if (attr->attr.overwrite && attr->attr.num_subbuf < 2) {
+               ret = LTTNG_ERR_INVALID;
+               goto error;
+       }
+
        switch (domain->type) {
        case LTTNG_DOMAIN_KERNEL:
        {
This page took 0.02295 seconds and 4 git commands to generate.