From 881881996ba715d8598ba78ad16ba07ce9e289f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 31 Jan 2020 17:58:56 -0500 Subject: [PATCH 1/1] Fix: relayd: return from function without unlocking session lock MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Some error paths in relay_close_trace_chunk() skip the unlock of the relay_session's lock. 412203 Missing unlock May result in deadlock if there is another attempt to acquire the lock. In relay_close_trace_chunk: Missing a release of a lock on a path (CWE-667) Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: I43187959abf00e761f7a255f4af7cd53e0c451fb --- src/bin/lttng-relayd/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 3295b009a..3aef0fabc 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -2934,7 +2934,7 @@ static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr, new_path); if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) { ret = -1; - goto end; + goto end_unlock_session; } session->ongoing_rotation = false; } @@ -2952,7 +2952,7 @@ static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr, chunk_status = lttng_trace_chunk_rename_path(chunk, old_path); if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) { ret = -1; - goto end; + goto end_unlock_session; } } chunk_status = lttng_trace_chunk_set_close_timestamp( -- 2.34.1