X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconsumer.c;h=78b3f0799737139fc9067a601a39452e384b3e0e;hb=73811eccc9599ebf62e5f5bee49039cecc25c3eb;hp=990db9e2690eff92ec683b8dd1df1aef65542ab0;hpb=4c95e622041958250db73b497097ed93f7715e20;p=lttng-tools.git diff --git a/src/common/consumer.c b/src/common/consumer.c index 990db9e26..78b3f0799 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -102,6 +102,7 @@ static void notify_channel_pipe(struct lttng_consumer_local_data *ctx, msg.action = action; msg.chan = chan; + msg.key = key; do { ret = write(ctx->consumer_channel_pipe[1], &msg, sizeof(msg)); } while (ret < 0 && errno == EINTR); @@ -906,7 +907,7 @@ int consumer_add_channel(struct lttng_consumer_channel *channel, /* Channel already exist. Ignore the insertion */ ERR("Consumer add channel key %" PRIu64 " already exists!", channel->key); - ret = -1; + ret = LTTNG_ERR_KERN_CHAN_EXIST; goto end; } @@ -1959,6 +1960,13 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, } end: + /* + * Nullify the stream reference so it is not used after deletion. The + * consumer data lock MUST be acquired before being able to check for a + * NULL pointer value. + */ + stream->chan->metadata_stream = NULL; + pthread_mutex_unlock(&stream->lock); pthread_mutex_unlock(&consumer_data.lock);