swtpm: cuse: Lock thread_busy_lock reading thread_busy (Coverity)

Coverity is complaining that thread_busy needs to be locked before
reading. For consistency reasons now also lock thread_busy before reading
it. However, in this case it does not make a difference whether this lock
is held when reading thread_busy since file_ops_lock is held when the
thread_busy flag is set and when it is read with a call to this function
(worker_thread_is_busy). Also while the thread is busy no further commands
can be submitted and it can then reset the thread_busy flag without holding
the file_ops_lock.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
diff --git a/src/swtpm/threadpool.c b/src/swtpm/threadpool.c
index aad1f4d..770c16a 100644
--- a/src/swtpm/threadpool.c
+++ b/src/swtpm/threadpool.c
@@ -128,7 +128,13 @@
  */
 int worker_thread_is_busy(void)
 {
-    return thread_busy;
+    int ret;
+
+    g_mutex_lock(THREAD_BUSY_LOCK);
+    ret = thread_busy;
+    g_mutex_unlock(THREAD_BUSY_LOCK);
+
+    return ret;
 }
 
 /*