X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fchannel.c;h=58a36b97c8b2f54085ed0b2ad463ef005c68d53a;hb=b024d072031acc6eec7e083de606fbce11aab882;hp=54345d9c94bfa96a70ab9cd0ab6ffb925a9d4953;hpb=91fe73e226b96814add53efc5c3e37b54452c68c;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/channel.c b/src/bin/lttng-sessiond/channel.c index 54345d9c9..58a36b97c 100644 --- a/src/bin/lttng-sessiond/channel.c +++ b/src/bin/lttng-sessiond/channel.c @@ -235,6 +235,21 @@ int channel_ust_create(struct ltt_ust_session *usess, int domain, attr = defattr; } + /* + * Validate UST buffer size and number of buffers: must both be + * power of 2 and nonzero. We validate right here for UST, + * because applications will not report the error to the user + * (unlike kernel tracing). + */ + if (!attr->attr.subbuf_size || (attr->attr.subbuf_size & (attr->attr.subbuf_size - 1))) { + ret = LTTCOMM_INVALID; + goto error; + } + if (!attr->attr.num_subbuf || (attr->attr.num_subbuf & (attr->attr.num_subbuf - 1))) { + ret = LTTCOMM_INVALID; + goto error; + } + /* Create UST channel */ uchan = trace_ust_create_channel(attr, usess->pathname); if (uchan == NULL) {