All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH lttng-tools] Fix: double put on error path
@ 2018-09-11  0:09 Jonathan Rajotte
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Rajotte @ 2018-09-11  0:09 UTC (permalink / raw)
  To: lttng-dev; +Cc: jgalar

Let relay_index_try_flush be responsible for the self-reference put on
error path.

Code flow of relay_index_try_flush is a bit tricky but the only error
flow (via relay_index_file_write) will always mark the index as flushed
and perform the self-reference put.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
---
 src/bin/lttng-relayd/main.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c
index 5a3bcb43f..2e2f5839f 100644
--- a/src/bin/lttng-relayd/main.c
+++ b/src/bin/lttng-relayd/main.c
@@ -2318,8 +2318,11 @@ static int relay_recv_index(const struct lttcomm_relayd_hdr *recv_hdr,
 		/* no flush. */
 		ret = 0;
 	} else {
+		/*
+		 * relay_index_try_flush is responsible for the self-reference
+		 * put of the index object on error.
+		 */
 		ERR("relay_index_try_flush error %d", ret);
-		relay_index_put(index);
 		ret = -1;
 	}
 
@@ -3217,9 +3220,11 @@ static int handle_index_data(struct relay_stream *stream, uint64_t net_seq_num,
 		/* No flush. */
 		ret = 0;
 	} else {
-		/* Put self-ref for this index due to error. */
-		relay_index_put(index);
-		index = NULL;
+		/*
+		 * relay_index_try_flush is responsible for the self-reference
+		 * put of the index object on error.
+		 */
+		ERR("relay_index_try_flush error %d", ret);
 		ret = -1;
 	}
 end:
-- 
2.17.1

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply related	[flat|nested] 2+ messages in thread
[parent not found: <20180911000915.29177-1-jonathan.rajotte-julien@efficios.com>]

end of thread, other threads:[~2018-09-19 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-11  0:09 [PATCH lttng-tools] Fix: double put on error path Jonathan Rajotte
     [not found] <20180911000915.29177-1-jonathan.rajotte-julien@efficios.com>
2018-09-19 15:52 ` Jérémie Galarneau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.