]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Avoid use-after-free of circ belonging to cancelled job
authorSebastian Hahn <sebastian@torproject.org>
Mon, 9 Feb 2015 15:04:51 +0000 (16:04 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Mon, 9 Feb 2015 15:12:47 +0000 (16:12 +0100)
This fixes a bug where we decide to free the circuit because it isn't on
any workqueue anymore, and then the job finishes and the circuit gets
freed again.

Fixes bug #14815, not in any released version of Tor.

src/or/cpuworker.c

index 5e8b32d780a5861dbb2e096f445df250eab4b532..7fe2351979b3508e2a11929d1917088be3bc641b 100644 (file)
@@ -556,8 +556,7 @@ cpuworker_cancel_circ_handshake(or_circuit_t *circ)
     tor_free(job);
     tor_assert(total_pending_tasks > 0);
     --total_pending_tasks;
+    circ->workqueue_entry = NULL;
   }
-
-  circ->workqueue_entry = NULL;
 }