projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: Missing rcu_read_lock in cmd_list_channels()
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
cmd.c
diff --git
a/src/bin/lttng-sessiond/cmd.c
b/src/bin/lttng-sessiond/cmd.c
index 022d5cee14aef361780e400c37ef31877728550e..f76a4422ea644b6997b46a6ed8620f27d9ad49b2 100644
(file)
--- a/
src/bin/lttng-sessiond/cmd.c
+++ b/
src/bin/lttng-sessiond/cmd.c
@@
-1805,7
+1805,9
@@
int cmd_start_trace(struct ltt_session *session)
* possible to enable channel thus inform the client.
*/
if (usess && usess->domain_global.channels) {
* 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);
nb_chan += lttng_ht_get_count(usess->domain_global.channels);
+ rcu_read_unlock();
}
if (ksession) {
nb_chan += ksession->channel_count;
}
if (ksession) {
nb_chan += ksession->channel_count;
@@
-2384,8
+2386,10
@@
ssize_t cmd_list_channels(int domain, struct ltt_session *session,
break;
case LTTNG_DOMAIN_UST:
if (session->ust_session != NULL) {
break;
case LTTNG_DOMAIN_UST:
if (session->ust_session != NULL) {
+ rcu_read_lock();
nb_chan = lttng_ht_get_count(
nb_chan = lttng_ht_get_count(
- session->ust_session->domain_global.channels);
+ session->ust_session->domain_global.channels);
+ rcu_read_unlock();
}
DBG3("Number of UST global channels %zd", nb_chan);
if (nb_chan < 0) {
}
DBG3("Number of UST global channels %zd", nb_chan);
if (nb_chan < 0) {
@@
-2691,7
+2695,7
@@
ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
struct lttng_snapshot_output **outputs)
{
int ret, idx = 0;
struct lttng_snapshot_output **outputs)
{
int ret, idx = 0;
- struct lttng_snapshot_output *list;
+ struct lttng_snapshot_output *list
= NULL
;
struct lttng_ht_iter iter;
struct snapshot_output *output;
struct lttng_ht_iter iter;
struct snapshot_output *output;
@@
-2705,7
+2709,7
@@
ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
* set in no output mode.
*/
if (session->output_traces) {
* set in no output mode.
*/
if (session->output_traces) {
- ret = LTTNG_ERR_EPERM;
+ ret =
-
LTTNG_ERR_EPERM;
goto error;
}
goto error;
}
@@
-2716,11
+2720,12
@@
ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
list = zmalloc(session->snapshot.nb_output * sizeof(*list));
if (!list) {
list = zmalloc(session->snapshot.nb_output * sizeof(*list));
if (!list) {
- ret = LTTNG_ERR_NOMEM;
+ ret =
-
LTTNG_ERR_NOMEM;
goto error;
}
/* Copy list from session to the new list object. */
goto error;
}
/* Copy list from session to the new list object. */
+ rcu_read_lock();
cds_lfht_for_each_entry(session->snapshot.output_ht->ht, &iter.iter,
output, node.node) {
assert(output->consumer);
cds_lfht_for_each_entry(session->snapshot.output_ht->ht, &iter.iter,
output, node.node) {
assert(output->consumer);
@@
-2735,28
+2740,28
@@
ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
ret = uri_to_str_url(&output->consumer->dst.net.control,
list[idx].ctrl_url, sizeof(list[idx].ctrl_url));
if (ret < 0) {
ret = uri_to_str_url(&output->consumer->dst.net.control,
list[idx].ctrl_url, sizeof(list[idx].ctrl_url));
if (ret < 0) {
- ret = LTTNG_ERR_NOMEM;
- goto
free_
error;
+ ret =
-
LTTNG_ERR_NOMEM;
+ goto error;
}
/* Data URI. */
ret = uri_to_str_url(&output->consumer->dst.net.data,
list[idx].data_url, sizeof(list[idx].data_url));
if (ret < 0) {
}
/* Data URI. */
ret = uri_to_str_url(&output->consumer->dst.net.data,
list[idx].data_url, sizeof(list[idx].data_url));
if (ret < 0) {
- ret = LTTNG_ERR_NOMEM;
- goto
free_
error;
+ ret =
-
LTTNG_ERR_NOMEM;
+ goto error;
}
}
idx++;
}
*outputs = list;
}
}
idx++;
}
*outputs = list;
- return session->snapshot.nb_output;
-
-free_error:
- free(list);
+ list = NULL;
+ ret = session->snapshot.nb_output;
error:
error:
- return -ret;
+ free(list);
+ rcu_read_unlock();
+ return ret;
}
/*
}
/*
This page took
0.047585 seconds
and
4
git commands to generate.