Fix: use after free on metadata cache reallocation
[lttng-modules.git] / lttng-abi.c
index cffebcd8b0fc60a646101d02553bc87a269a6272..a9e8d1d0423f4120144808585773c2234649a67e 100644 (file)
@@ -541,9 +541,11 @@ unsigned int lttng_metadata_ring_buffer_poll(struct file *filp,
                if (finalized)
                        mask |= POLLHUP;
 
+               mutex_lock(&stream->metadata_cache->lock);
                if (stream->metadata_cache->metadata_written >
                                stream->metadata_out)
                        mask |= POLLIN;
+               mutex_unlock(&stream->metadata_cache->lock);
        }
 
        return mask;
@@ -841,7 +843,6 @@ int lttng_abi_open_metadata_stream(struct file *channel_file)
        metadata_stream->priv = buf;
        stream_priv = metadata_stream;
        metadata_stream->transport = channel->transport;
-       mutex_init(&metadata_stream->lock);
 
        /*
         * Since life-time of metadata cache differs from that of
This page took 0.023152 seconds and 4 git commands to generate.