From ba1c40c6095cdcb25c9c3be8bd72b09755f1f116 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 9 Mar 2016 19:37:56 -0500 Subject: [PATCH] Fix: application context header size We need to use the RCU-dereferenced pointer when calculating the context header size, else it may race with application context register/unregister. Signed-off-by: Mathieu Desnoyers --- liblttng-ust/lttng-ring-buffer-client.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/liblttng-ust/lttng-ring-buffer-client.h b/liblttng-ust/lttng-ring-buffer-client.h index 97e1f440..1ebb14e4 100644 --- a/liblttng-ust/lttng-ring-buffer-client.h +++ b/liblttng-ust/lttng-ring-buffer-client.h @@ -118,7 +118,7 @@ size_t record_header_size(const struct lttng_ust_lib_ring_buffer_config *config, struct lttng_ust_lib_ring_buffer_ctx *ctx) { struct lttng_channel *lttng_chan = channel_get_private(chan); - struct lttng_event *event = ctx->priv; + struct lttng_stack_ctx *lttng_ctx = ctx->priv2; size_t orig_offset = offset; size_t padding; @@ -157,8 +157,8 @@ size_t record_header_size(const struct lttng_ust_lib_ring_buffer_config *config, padding = 0; WARN_ON_ONCE(1); } - offset += ctx_get_size(offset, lttng_chan->ctx); - offset += ctx_get_size(offset, event->ctx); + offset += ctx_get_size(offset, lttng_ctx->chan_ctx); + offset += ctx_get_size(offset, lttng_ctx->event_ctx); *pre_header_padding = padding; return offset - orig_offset; -- 2.34.1