]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Call connection_or_close_for_error() properly if write_to_buf() ever fails on an...
authorAndrea Shepard <andrea@torproject.org>
Wed, 16 Apr 2014 04:25:49 +0000 (21:25 -0700)
committerAndrea Shepard <andrea@torproject.org>
Wed, 16 Apr 2014 04:25:49 +0000 (21:25 -0700)
changes/bug11304 [new file with mode: 0644]
src/or/connection.c

diff --git a/changes/bug11304 b/changes/bug11304
new file mode 100644 (file)
index 0000000..2ea165f
--- /dev/null
@@ -0,0 +1,5 @@
+  o Bugfixes:
+    - If write_to_buf() in connection_write_to_buf_impl_() ever fails,
+      check if it's an or_connection_t and correctly call
+      connection_or_close_for_error() rather than connection_mark_for_close()
+      directly.  Fixes bug #11304.
index 1be4c45dd7fba5cdc278f041c76fc86eac145625..5f9eecb8904fed5ffbbf86b54bd0078f731e0ca6 100644 (file)
@@ -4009,6 +4009,12 @@ connection_write_to_buf_impl_,(const char *string, size_t len,
                "write_to_buf failed. Closing circuit (fd %d).", (int)conn->s);
       circuit_mark_for_close(circuit_get_by_edge_conn(TO_EDGE_CONN(conn)),
                              END_CIRC_REASON_INTERNAL);
+    } else if (conn->type == CONN_TYPE_OR) {
+      or_connection_t *orconn = TO_OR_CONN(conn);
+      log_warn(LD_NET,
+               "write_to_buf failed on an orconn; notifying of error "
+               "(fd %d)", (int)(conn->s));
+      connection_or_close_for_error(orconn, 0);
     } else {
       log_warn(LD_NET,
                "write_to_buf failed. Closing connection (fd %d).",