lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: jgalar@efficios.com
Cc: lttng-dev@lists.lttng.org
Subject: [PATCH babeltrace-1.5 1/6] Fix: lttng-live: use-after-free in get_next_index()
Date: Thu,  5 Dec 2019 01:58:04 -0500	[thread overview]
Message-ID: <20191205065809.16728-2-mathieu.desnoyers__45016.8532946677$1575529177$gmane$org@efficios.com> (raw)
In-Reply-To: <20191205065809.16728-1-mathieu.desnoyers@efficios.com>

Running babeltrace under valgrind with a test-cases doing per-pid
lttng tracing in live mode triggers this use-after-free in
get_next_index() when stream is hung up.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 formats/lttng-live/lttng-live-comm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c
index 33a78029..96817f5e 100644
--- a/formats/lttng-live/lttng-live-comm.c
+++ b/formats/lttng-live/lttng-live-comm.c
@@ -1108,8 +1108,8 @@ retry:
 		viewer_stream->in_trace = 0;
 		bt_list_del(&viewer_stream->trace_stream_node);
 		bt_list_del(&viewer_stream->session_stream_node);
-		g_free(viewer_stream);
 		*stream_id = be64toh(rp->stream_id);
+		g_free(viewer_stream);
 		break;
 	case LTTNG_VIEWER_INDEX_ERR:
 		fprintf(stderr, "[error] get_next_index: error\n");
-- 
2.17.1

       reply	other threads:[~2019-12-05  6:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191205065809.16728-1-mathieu.desnoyers@efficios.com>
2019-12-05  6:58 ` Mathieu Desnoyers [this message]
2019-12-05  6:58 ` [PATCH babeltrace-1.5 2/6] Fix: trace-collection: trace clock use after free Mathieu Desnoyers
2019-12-05  6:58 ` [PATCH babeltrace-1.5 3/6] Fix: lttng-live: lttng_live_open_trace_read memory leak Mathieu Desnoyers
2019-12-05  6:58 ` [PATCH babeltrace-1.5 4/6] Fix: lib/iterator.c: unbalanced ctx put (leak) Mathieu Desnoyers
2019-12-05  6:58 ` [PATCH babeltrace-1.5 5/6] Fix: lttng-live: ctf_live_packet_seek stream hang up handling Mathieu Desnoyers
2019-12-05  6:58 ` [PATCH babeltrace-1.5 6/6] Fix: lttng-live format: do not error out on empty streams hang up Mathieu Desnoyers
     [not found] ` <20191205065809.16728-7-mathieu.desnoyers@efficios.com>
2019-12-13  1:03   ` Jérémie Galarneau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20191205065809.16728-2-mathieu.desnoyers__45016.8532946677$1575529177$gmane$org@efficios.com' \
    --to=mathieu.desnoyers@efficios.com \
    --cc=jgalar@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    --subject='Re: [PATCH babeltrace-1.5 1/6] Fix: lttng-live: use-after-free in get_next_index()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).