@srv must be unlocked for the call virNetServerProcessMsg otherwise a
deadlock can occur.
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
---
src/rpc/virnetserver.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 5c7f7dd08f..5ae809e372 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -201,7 +201,7 @@ static void virNetServerDispatchNewMessage(virNetServerClientPtr
client,
virNetServerJobPtr job;
if (VIR_ALLOC(job) < 0)
- goto error;
+ goto error_unlock;
job->client = client;
job->msg = msg;
@@ -216,20 +216,23 @@ static void virNetServerDispatchNewMessage(virNetServerClientPtr
client,
virObjectUnref(client);
VIR_FREE(job);
virObjectUnref(prog);
- goto error;
+ goto error_unlock;
}
+ virObjectUnlock(srv);
} else {
+ /* @srv must be unlocked for virNetServerProcessMsg */
+ virObjectUnlock(srv);
if (virNetServerProcessMsg(srv, client, prog, msg) < 0)
goto error;
}
- virObjectUnlock(srv);
return;
+ error_unlock:
+ virObjectUnlock(srv);
error:
virNetMessageFree(msg);
virNetServerClientClose(client);
- virObjectUnlock(srv);
}
/**
--
2.13.6