Fix OOPS caused by reference of config pointer
[lttng-modules.git] / lib / ringbuffer / backend_types.h
index 1d301de2e178f8bc992ceb842ff8a4522f359618..4578185c3c75d8a1fb307a5e78ddbb1567bbd878 100644 (file)
@@ -53,7 +53,7 @@ struct lib_ring_buffer_backend {
        struct channel *chan;           /* Associated channel */
        int cpu;                        /* This buffer's cpu. -1 if global. */
        union v_atomic records_read;    /* Number of records read */
-       unsigned int allocated:1;       /* Bool: is buffer allocated ? */
+       unsigned int allocated:1;       /* is buffer allocated ? */
 };
 
 struct channel_backend {
@@ -65,14 +65,19 @@ struct channel_backend {
                                         * for writer.
                                         */
        unsigned int buf_size_order;    /* Order of buffer size */
-       int extra_reader_sb:1;          /* Bool: has extra reader subbuffer */
+       unsigned int extra_reader_sb:1; /* has extra reader subbuffer ? */
        struct lib_ring_buffer *buf;    /* Channel per-cpu buffers */
 
        unsigned long num_subbuf;       /* Number of sub-buffers for writer */
        u64 start_tsc;                  /* Channel creation TSC value */
        void *priv;                     /* Client-specific information */
        struct notifier_block cpu_hp_notifier;   /* CPU hotplug notifier */
-       const struct lib_ring_buffer_config *config; /* Ring buffer configuration */
+       /*
+        * We need to copy config because the module containing the
+        * source config can vanish before the last reference to this
+        * channel's streams is released.
+        */
+       struct lib_ring_buffer_config config; /* Ring buffer configuration */
        cpumask_var_t cpumask;          /* Allocated per-cpu buffers cpumask */
        char name[NAME_MAX];            /* Channel name */
 };
This page took 0.023595 seconds and 4 git commands to generate.