From: Mathieu Desnoyers Date: Tue, 13 Dec 2011 21:37:51 +0000 (-0500) Subject: Fix OOPS caused by reference of config pointer X-Git-Tag: v2.0-pre11~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5a8fd222992df9bbb709836e5bf4ca053dd776c3;p=lttng-modules.git Fix OOPS caused by reference of config pointer The config pointer points to data that may vanish across the life-time of the ring buffer stream references. It's only kept valid for the duration between the channel create and destroy, but the streams can keep an extra reference on the channel, and thus need the config to stay valid. Perform a copy of the config rather than keeping a pointer to it. Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/ringbuffer/backend_types.h b/lib/ringbuffer/backend_types.h index 3d1fcc06..4578185c 100644 --- a/lib/ringbuffer/backend_types.h +++ b/lib/ringbuffer/backend_types.h @@ -72,7 +72,12 @@ struct channel_backend { 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 */ }; diff --git a/lib/ringbuffer/ring_buffer_backend.c b/lib/ringbuffer/ring_buffer_backend.c index d1b5b8cd..11dd924e 100644 --- a/lib/ringbuffer/ring_buffer_backend.c +++ b/lib/ringbuffer/ring_buffer_backend.c @@ -155,7 +155,7 @@ pages_error: int lib_ring_buffer_backend_create(struct lib_ring_buffer_backend *bufb, struct channel_backend *chanb, int cpu) { - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; bufb->chan = container_of(chanb, struct channel, backend); bufb->cpu = cpu; @@ -187,7 +187,7 @@ void lib_ring_buffer_backend_free(struct lib_ring_buffer_backend *bufb) void lib_ring_buffer_backend_reset(struct lib_ring_buffer_backend *bufb) { struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; unsigned long num_subbuf_alloc; unsigned int i; @@ -221,7 +221,7 @@ void lib_ring_buffer_backend_reset(struct lib_ring_buffer_backend *bufb) void channel_backend_reset(struct channel_backend *chanb) { struct channel *chan = container_of(chanb, struct channel, backend); - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; /* * Don't reset buf_size, subbuf_size, subbuf_size_order, @@ -248,7 +248,7 @@ int __cpuinit lib_ring_buffer_cpu_hp_callback(struct notifier_block *nb, unsigned int cpu = (unsigned long)hcpu; struct channel_backend *chanb = container_of(nb, struct channel_backend, cpu_hp_notifier); - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; struct lib_ring_buffer *buf; int ret; @@ -334,7 +334,7 @@ int channel_backend_init(struct channel_backend *chanb, (config->mode == RING_BUFFER_OVERWRITE) ? 1 : 0; chanb->num_subbuf = num_subbuf; strlcpy(chanb->name, name, NAME_MAX); - chanb->config = config; + memcpy(&chanb->config, config, sizeof(chanb->config)); if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { if (!zalloc_cpumask_var(&chanb->cpumask, GFP_KERNEL)) @@ -421,7 +421,7 @@ free_cpumask: */ void channel_backend_unregister_notifiers(struct channel_backend *chanb) { - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) unregister_hotcpu_notifier(&chanb->cpu_hp_notifier); @@ -435,7 +435,7 @@ void channel_backend_unregister_notifiers(struct channel_backend *chanb) */ void channel_backend_free(struct channel_backend *chanb) { - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; unsigned int i; if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { @@ -469,7 +469,7 @@ void _lib_ring_buffer_write(struct lib_ring_buffer_backend *bufb, size_t offset, const void *src, size_t len, ssize_t pagecpy) { struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; size_t sbidx, index; struct lib_ring_buffer_backend_pages *rpages; unsigned long sb_bindex, id; @@ -515,7 +515,7 @@ void _lib_ring_buffer_memset(struct lib_ring_buffer_backend *bufb, int c, size_t len, ssize_t pagecpy) { struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; size_t sbidx, index; struct lib_ring_buffer_backend_pages *rpages; unsigned long sb_bindex, id; @@ -564,7 +564,7 @@ void _lib_ring_buffer_copy_from_user(struct lib_ring_buffer_backend *bufb, ssize_t pagecpy) { struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; size_t sbidx, index; struct lib_ring_buffer_backend_pages *rpages; unsigned long sb_bindex, id; @@ -616,7 +616,7 @@ size_t lib_ring_buffer_read(struct lib_ring_buffer_backend *bufb, size_t offset, void *dest, size_t len) { struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; size_t index; ssize_t pagecpy, orig_len; struct lib_ring_buffer_backend_pages *rpages; @@ -668,7 +668,7 @@ int __lib_ring_buffer_copy_to_user(struct lib_ring_buffer_backend *bufb, size_t offset, void __user *dest, size_t len) { struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; size_t index; ssize_t pagecpy; struct lib_ring_buffer_backend_pages *rpages; @@ -719,7 +719,7 @@ int lib_ring_buffer_read_cstr(struct lib_ring_buffer_backend *bufb, size_t offse void *dest, size_t len) { struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; size_t index; ssize_t pagecpy, pagelen, strpagelen, orig_offset; char *str; @@ -777,7 +777,7 @@ struct page **lib_ring_buffer_read_get_page(struct lib_ring_buffer_backend *bufb size_t index; struct lib_ring_buffer_backend_pages *rpages; struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; unsigned long sb_bindex, id; offset &= chanb->buf_size - 1; @@ -808,7 +808,7 @@ void *lib_ring_buffer_read_offset_address(struct lib_ring_buffer_backend *bufb, size_t index; struct lib_ring_buffer_backend_pages *rpages; struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; unsigned long sb_bindex, id; offset &= chanb->buf_size - 1; @@ -838,7 +838,7 @@ void *lib_ring_buffer_offset_address(struct lib_ring_buffer_backend *bufb, size_t sbidx, index; struct lib_ring_buffer_backend_pages *rpages; struct channel_backend *chanb = &bufb->chan->backend; - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; unsigned long sb_bindex, id; offset &= chanb->buf_size - 1; diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c index 957d7f3d..bf0db116 100644 --- a/lib/ringbuffer/ring_buffer_frontend.c +++ b/lib/ringbuffer/ring_buffer_frontend.c @@ -103,7 +103,7 @@ void lib_ring_buffer_free(struct lib_ring_buffer *buf) void lib_ring_buffer_reset(struct lib_ring_buffer *buf) { struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned int i; /* @@ -161,7 +161,7 @@ EXPORT_SYMBOL_GPL(channel_reset); int lib_ring_buffer_create(struct lib_ring_buffer *buf, struct channel_backend *chanb, int cpu) { - const struct lib_ring_buffer_config *config = chanb->config; + const struct lib_ring_buffer_config *config = &chanb->config; struct channel *chan = container_of(chanb, struct channel, backend); void *priv = chanb->priv; size_t subbuf_header_size; @@ -253,7 +253,7 @@ static void switch_buffer_timer(unsigned long data) { struct lib_ring_buffer *buf = (struct lib_ring_buffer *)data; struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; /* * Only flush buffers periodically if readers are active. @@ -275,7 +275,7 @@ static void switch_buffer_timer(unsigned long data) static void lib_ring_buffer_start_switch_timer(struct lib_ring_buffer *buf) { struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (!chan->switch_timer_interval || buf->switch_timer_enabled) return; @@ -311,7 +311,7 @@ static void read_buffer_timer(unsigned long data) { struct lib_ring_buffer *buf = (struct lib_ring_buffer *)data; struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; CHAN_WARN_ON(chan, !buf->backend.allocated); @@ -335,7 +335,7 @@ static void read_buffer_timer(unsigned long data) static void lib_ring_buffer_start_read_timer(struct lib_ring_buffer *buf) { struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (config->wakeup != RING_BUFFER_WAKEUP_BY_TIMER || !chan->read_timer_interval @@ -360,7 +360,7 @@ static void lib_ring_buffer_start_read_timer(struct lib_ring_buffer *buf) static void lib_ring_buffer_stop_read_timer(struct lib_ring_buffer *buf) { struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (config->wakeup != RING_BUFFER_WAKEUP_BY_TIMER || !chan->read_timer_interval @@ -397,7 +397,7 @@ int __cpuinit lib_ring_buffer_cpu_hp_callback(struct notifier_block *nb, struct channel *chan = container_of(nb, struct channel, cpu_hp_notifier); struct lib_ring_buffer *buf = per_cpu_ptr(chan->backend.buf, cpu); - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (!chan->cpu_hp_enable) return NOTIFY_DONE; @@ -452,7 +452,7 @@ static int notrace ring_buffer_tick_nohz_callback(struct notifier_block *nb, { struct channel *chan = container_of(nb, struct channel, tick_nohz_notifier); - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; struct lib_ring_buffer *buf; int cpu = smp_processor_id(); @@ -524,7 +524,7 @@ void notrace lib_ring_buffer_tick_nohz_restart(void) */ static void channel_unregister_notifiers(struct channel *chan) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; int cpu; channel_iterator_unregister_notifiers(chan); @@ -708,7 +708,7 @@ void channel_release(struct kref *kref) void *channel_destroy(struct channel *chan) { int cpu; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; void *priv; channel_unregister_notifiers(chan); @@ -818,7 +818,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf, unsigned long *consumed, unsigned long *produced) { struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long consumed_cur, write_offset; int finalized; @@ -909,7 +909,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf, unsigned long consumed) { struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long consumed_cur, consumed_idx, commit_count, write_offset; int ret; int finalized; @@ -1055,7 +1055,7 @@ void lib_ring_buffer_put_subbuf(struct lib_ring_buffer *buf) { struct lib_ring_buffer_backend *bufb = &buf->backend; struct channel *chan = bufb->chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long read_sb_bindex, consumed_idx, consumed; CHAN_WARN_ON(chan, atomic_long_read(&buf->active_readers) != 1); @@ -1114,7 +1114,7 @@ void lib_ring_buffer_print_subbuffer_errors(struct lib_ring_buffer *buf, unsigned long cons_offset, int cpu) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long cons_idx, commit_count, commit_count_sb; cons_idx = subbuf_index(cons_offset, chan); @@ -1140,7 +1140,7 @@ void lib_ring_buffer_print_buffer_errors(struct lib_ring_buffer *buf, struct channel *chan, void *priv, int cpu) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long write_offset, cons_offset; /* @@ -1170,7 +1170,7 @@ static void lib_ring_buffer_print_errors(struct channel *chan, struct lib_ring_buffer *buf, int cpu) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; void *priv = chan->backend.priv; printk(KERN_DEBUG "ring buffer %s, cpu %d: %lu records written, " @@ -1205,7 +1205,7 @@ void lib_ring_buffer_switch_old_start(struct lib_ring_buffer *buf, struct switch_offsets *offsets, u64 tsc) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long oldidx = subbuf_index(offsets->old, chan); unsigned long commit_count; @@ -1249,7 +1249,7 @@ void lib_ring_buffer_switch_old_end(struct lib_ring_buffer *buf, struct switch_offsets *offsets, u64 tsc) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long oldidx = subbuf_index(offsets->old - 1, chan); unsigned long commit_count, padding_size, data_size; @@ -1292,7 +1292,7 @@ void lib_ring_buffer_switch_new_start(struct lib_ring_buffer *buf, struct switch_offsets *offsets, u64 tsc) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long beginidx = subbuf_index(offsets->begin, chan); unsigned long commit_count; @@ -1334,7 +1334,7 @@ void lib_ring_buffer_switch_new_end(struct lib_ring_buffer *buf, struct switch_offsets *offsets, u64 tsc) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long endidx = subbuf_index(offsets->end - 1, chan); unsigned long commit_count, padding_size, data_size; @@ -1376,7 +1376,7 @@ int lib_ring_buffer_try_switch_slow(enum switch_mode mode, struct switch_offsets *offsets, u64 *tsc) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long off; offsets->begin = v_read(config, &buf->offset); @@ -1435,7 +1435,7 @@ int lib_ring_buffer_try_switch_slow(enum switch_mode mode, void lib_ring_buffer_switch_slow(struct lib_ring_buffer *buf, enum switch_mode mode) { struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; struct switch_offsets offsets; unsigned long oldidx; u64 tsc; @@ -1496,7 +1496,7 @@ int lib_ring_buffer_try_reserve_slow(struct lib_ring_buffer *buf, struct switch_offsets *offsets, struct lib_ring_buffer_ctx *ctx) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long reserve_commit_diff; offsets->begin = v_read(config, &buf->offset); @@ -1631,7 +1631,7 @@ int lib_ring_buffer_try_reserve_slow(struct lib_ring_buffer *buf, int lib_ring_buffer_reserve_slow(struct lib_ring_buffer_ctx *ctx) { struct channel *chan = ctx->chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; struct lib_ring_buffer *buf; struct switch_offsets offsets; int ret; diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c index 1321b5f9..dbfe1f79 100644 --- a/lib/ringbuffer/ring_buffer_iterator.c +++ b/lib/ringbuffer/ring_buffer_iterator.c @@ -40,7 +40,7 @@ ssize_t lib_ring_buffer_get_next_record(struct channel *chan, struct lib_ring_buffer *buf) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; struct lib_ring_buffer_iter *iter = &buf->iter; int ret; @@ -225,7 +225,7 @@ void lib_ring_buffer_wait_for_qs(const struct lib_ring_buffer_config *config, ssize_t channel_get_next_record(struct channel *chan, struct lib_ring_buffer **ret_buf) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; struct lib_ring_buffer *buf; struct lttng_ptr_heap *heap; ssize_t len; @@ -333,7 +333,7 @@ void lib_ring_buffer_iterator_init(struct channel *chan, struct lib_ring_buffer } /* Add to list of buffers without any current record */ - if (chan->backend.config->alloc == RING_BUFFER_ALLOC_PER_CPU) + if (chan->backend.config.alloc == RING_BUFFER_ALLOC_PER_CPU) list_add(&buf->iter.empty_node, &chan->iter.empty_head); } @@ -347,7 +347,7 @@ int __cpuinit channel_iterator_cpu_hotplug(struct notifier_block *nb, struct channel *chan = container_of(nb, struct channel, hp_iter_notifier); struct lib_ring_buffer *buf = per_cpu_ptr(chan->backend.buf, cpu); - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (!chan->hp_iter_enable) return NOTIFY_DONE; @@ -369,7 +369,7 @@ int __cpuinit channel_iterator_cpu_hotplug(struct notifier_block *nb, int channel_iterator_init(struct channel *chan) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; struct lib_ring_buffer *buf; if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { @@ -413,7 +413,7 @@ int channel_iterator_init(struct channel *chan) void channel_iterator_unregister_notifiers(struct channel *chan) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { chan->hp_iter_enable = 0; @@ -423,7 +423,7 @@ void channel_iterator_unregister_notifiers(struct channel *chan) void channel_iterator_free(struct channel *chan) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) lttng_heap_free(&chan->iter.heap); @@ -432,7 +432,7 @@ void channel_iterator_free(struct channel *chan) int lib_ring_buffer_iterator_open(struct lib_ring_buffer *buf) { struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; CHAN_WARN_ON(chan, config->output != RING_BUFFER_ITERATOR); return lib_ring_buffer_open_read(buf); } @@ -451,7 +451,7 @@ EXPORT_SYMBOL_GPL(lib_ring_buffer_iterator_release); int channel_iterator_open(struct channel *chan) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; struct lib_ring_buffer *buf; int ret = 0, cpu; @@ -484,7 +484,7 @@ EXPORT_SYMBOL_GPL(channel_iterator_open); void channel_iterator_release(struct channel *chan) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; struct lib_ring_buffer *buf; int cpu; @@ -527,7 +527,7 @@ void lib_ring_buffer_iterator_reset(struct lib_ring_buffer *buf) void channel_iterator_reset(struct channel *chan) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; struct lib_ring_buffer *buf; int cpu; @@ -558,7 +558,7 @@ ssize_t channel_ring_buffer_file_read(struct file *filp, struct lib_ring_buffer *buf, int fusionmerge) { - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; size_t read_count = 0, read_offset; ssize_t len; @@ -706,7 +706,7 @@ ssize_t channel_file_read(struct file *filp, { struct inode *inode = filp->f_dentry->d_inode; struct channel *chan = inode->i_private; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) return channel_ring_buffer_file_read(filp, user_buf, count, diff --git a/lib/ringbuffer/ring_buffer_mmap.c b/lib/ringbuffer/ring_buffer_mmap.c index c9d6e89a..8ff5e46a 100644 --- a/lib/ringbuffer/ring_buffer_mmap.c +++ b/lib/ringbuffer/ring_buffer_mmap.c @@ -24,7 +24,7 @@ static int lib_ring_buffer_fault(struct vm_area_struct *vma, struct vm_fault *vm { struct lib_ring_buffer *buf = vma->vm_private_data; struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; pgoff_t pgoff = vmf->pgoff; struct page **page; void **virt; @@ -74,7 +74,7 @@ static int lib_ring_buffer_mmap_buf(struct lib_ring_buffer *buf, { unsigned long length = vma->vm_end - vma->vm_start; struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned long mmap_buf_len; if (config->output != RING_BUFFER_MMAP) diff --git a/lib/ringbuffer/ring_buffer_splice.c b/lib/ringbuffer/ring_buffer_splice.c index ded18ba8..41a6ff8a 100644 --- a/lib/ringbuffer/ring_buffer_splice.c +++ b/lib/ringbuffer/ring_buffer_splice.c @@ -69,7 +69,7 @@ static int subbuf_splice_actor(struct file *in, { struct lib_ring_buffer *buf = in->private_data; struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; unsigned int poff, subbuf_pages, nr_pages; struct page *pages[PIPE_DEF_BUFFERS]; struct partial_page partial[PIPE_DEF_BUFFERS]; @@ -151,7 +151,7 @@ ssize_t lib_ring_buffer_splice_read(struct file *in, loff_t *ppos, { struct lib_ring_buffer *buf = in->private_data; struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; ssize_t spliced; int ret; diff --git a/lib/ringbuffer/ring_buffer_vfs.c b/lib/ringbuffer/ring_buffer_vfs.c index 8b783052..51d8a4d4 100644 --- a/lib/ringbuffer/ring_buffer_vfs.c +++ b/lib/ringbuffer/ring_buffer_vfs.c @@ -88,7 +88,7 @@ unsigned int lib_ring_buffer_poll(struct file *filp, poll_table *wait) unsigned int mask = 0; struct lib_ring_buffer *buf = filp->private_data; struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; int finalized, disabled; if (filp->f_mode & FMODE_READ) { @@ -165,7 +165,7 @@ long lib_ring_buffer_ioctl(struct file *filp, unsigned int cmd, unsigned long ar { struct lib_ring_buffer *buf = filp->private_data; struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (lib_ring_buffer_channel_is_disabled(chan)) return -EIO; @@ -262,7 +262,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd, { struct lib_ring_buffer *buf = filp->private_data; struct channel *chan = buf->backend.chan; - const struct lib_ring_buffer_config *config = chan->backend.config; + const struct lib_ring_buffer_config *config = &chan->backend.config; if (lib_ring_buffer_channel_is_disabled(chan)) return -EIO;