From 0857cc59286606da5883291118482e8f5a4c19ed Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 10 Jan 2013 17:16:01 -0800 Subject: [PATCH] worker: Make worker_request_iovec() verify that it is not being reentered. This function cannot easily be reentrant because the inner call would interrupt and corrupt the data being sent by the outer call. Signed-off-by: Ben Pfaff Acked-by: Kyle Mestery --- lib/worker.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/worker.c b/lib/worker.c index b281d70b7..eceac3d9e 100644 --- a/lib/worker.c +++ b/lib/worker.c @@ -237,11 +237,14 @@ worker_request_iovec(const struct iovec iovs[], size_t n_iovs, worker_request_func *request_cb, worker_reply_func *reply_cb, void *aux) { + static bool recursing = false; struct worker_request rq; struct iovec *all_iovs; int error; assert(worker_is_running()); + assert(!recursing); + recursing = true; rq.request_len = iovec_len(iovs, n_iovs); rq.request_cb = request_cb; @@ -255,6 +258,8 @@ worker_request_iovec(const struct iovec iovs[], size_t n_iovs, VLOG_ABORT("send failed (%s)", strerror(error)); } free(all_iovs); + + recursing = false; } /* Closes the client socket, if any, so that worker_is_running() will return -- 2.43.0