[tor-commits] [tor/master] hs: Avoid possible double circuit close on error

nickm at torproject.org nickm at torproject.org
Thu Sep 21 18:05:21 UTC 2017


commit 6045bdd4a0542ef11dc46d98495686172015a961
Author: David Goulet <dgoulet at torproject.org>
Date:   Thu Sep 21 13:13:44 2017 -0400

    hs: Avoid possible double circuit close on error
    
    Fixes #23610
    
    Signed-off-by: David Goulet <dgoulet at torproject.org>
---
 changes/bug23610       | 4 ++++
 src/or/hs_intropoint.c | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/changes/bug23610 b/changes/bug23610
new file mode 100644
index 000000000..3d868524e
--- /dev/null
+++ b/changes/bug23610
@@ -0,0 +1,4 @@
+  o Minor bugfixes (hidden service, relay):
+    - Avoid a possible double close of a circuit by the intro point on error
+      of sending the INTRO_ESTABLISHED cell. Fixes ticket 23610.; bugfix on
+      0.3.2.1-alpha.
diff --git a/src/or/hs_intropoint.c b/src/or/hs_intropoint.c
index cb4d6c02e..4a5202f61 100644
--- a/src/or/hs_intropoint.c
+++ b/src/or/hs_intropoint.c
@@ -255,7 +255,11 @@ handle_establish_intro(or_circuit_t *circ, const uint8_t *request,
   goto done;
 
  err:
-  circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_TORPROTOCOL);
+  /* When sending the intro establish ack, on error the circuit can be marked
+   * as closed so avoid a double close. */
+  if (!TO_CIRCUIT(circ)->marked_for_close) {
+    circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_TORPROTOCOL);
+  }
 
  done:
   trn_cell_establish_intro_free(parsed_cell);



More information about the tor-commits mailing list