X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=30cfc21c4f07fc5f90d637d260a8cbe3740b5a41;hb=1a29cff2973695e90fa1688b15760c8e98863d6b;hp=95e371d7b66fe527da607a7c60d0c49b871a2e63;hpb=00a620843422e5c972aee0ada2181b811fc81b92;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 95e371d7b..30cfc21c4 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -38,6 +38,7 @@ #include "lttng-sessiond.h" #include "utils.h" #include "syscall.h" +#include "agent.h" #include "cmd.h" @@ -1382,6 +1383,7 @@ static int validate_event_name(const char *name) int ret = 0; const char *c = name; const char *event_name_end = c + LTTNG_SYMBOL_NAME_LEN; + bool null_terminated = false; /* * Make sure that unescaped wildcards are only used as the last @@ -1390,6 +1392,7 @@ static int validate_event_name(const char *name) while (c < event_name_end) { switch (*c) { case '\0': + null_terminated = true; goto end; case '\\': c++; @@ -1406,6 +1409,9 @@ static int validate_event_name(const char *name) c++; } end: + if (!ret && !null_terminated) { + ret = LTTNG_ERR_INVALID_EVENT_NAME; + } return ret; } @@ -1512,6 +1518,9 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, event->type = LTTNG_EVENT_TRACEPOINT; /* Hack */ ret = event_kernel_enable_event(kchan, event, filter_expression, filter); + /* We have passed ownership */ + filter_expression = NULL; + filter = NULL; if (ret != LTTNG_OK) { if (channel_created) { /* Let's not leak a useless channel. */ @@ -1537,6 +1546,9 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, case LTTNG_EVENT_TRACEPOINT: ret = event_kernel_enable_event(kchan, event, filter_expression, filter); + /* We have passed ownership */ + filter_expression = NULL; + filter = NULL; if (ret != LTTNG_OK) { if (channel_created) { /* Let's not leak a useless channel. */ @@ -1548,6 +1560,9 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, case LTTNG_EVENT_SYSCALL: ret = event_kernel_enable_event(kchan, event, filter_expression, filter); + /* We have passed ownership */ + filter_expression = NULL; + filter = NULL; if (ret != LTTNG_OK) { goto error; } @@ -1888,9 +1903,7 @@ int cmd_start_trace(struct ltt_session *session) * possible to enable channel thus inform the client. */ if (usess && usess->domain_global.channels) { - rcu_read_lock(); nb_chan += lttng_ht_get_count(usess->domain_global.channels); - rcu_read_unlock(); } if (ksession) { nb_chan += ksession->channel_count; @@ -2447,6 +2460,10 @@ ssize_t cmd_list_domains(struct ltt_session *session, if (session->kernel_session != NULL) { (*domains)[index].type = LTTNG_DOMAIN_KERNEL; + + /* Kernel session buffer type is always GLOBAL */ + (*domains)[index].buf_type = LTTNG_BUFFER_GLOBAL; + index++; }